From 927a9d41317ab602ae6ca1810013d0d574834a8a Mon Sep 17 00:00:00 2001 From: Laurent Mazuel Date: Thu, 12 May 2016 11:04:28 -0700 Subject: [PATCH 01/22] Add platform in Python UserAgent --- ClientRuntimes/Python/msrest/msrest/configuration.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ClientRuntimes/Python/msrest/msrest/configuration.py b/ClientRuntimes/Python/msrest/msrest/configuration.py index 0c2ae4785d6a..f9b4e06d2097 100644 --- a/ClientRuntimes/Python/msrest/msrest/configuration.py +++ b/ClientRuntimes/Python/msrest/msrest/configuration.py @@ -31,7 +31,7 @@ except ImportError: import ConfigParser as configparser from ConfigParser import NoOptionError -import sys +import platform import requests @@ -68,8 +68,9 @@ def __init__(self, base_url, filepath=None): self.redirect_policy = ClientRedirectPolicy() # User-Agent Header - self._user_agent = "python/{} requests/{} msrest/{}".format( - sys.version.split(' ')[0], + self._user_agent = "python/{} ({}) requests/{} msrest/{}".format( + platform.python_version(), + platform.platform(), requests.__version__, msrest_version) From fae2d8ae44ca38b57b5f7005b5ed53c7a9e2c25a Mon Sep 17 00:00:00 2001 From: annatisch Date: Mon, 9 May 2016 10:58:52 -0700 Subject: [PATCH 02/22] Change body serialization for complex type --- .../AzureLongRunningMethodTemplate.cshtml | 29 +++++++++++++----- .../AzurePagingMethodTemplate.cshtml | 22 +++++++++++--- .../Python/Templates/MethodTemplate.cshtml | 30 ++++++++++++++----- 3 files changed, 62 insertions(+), 19 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml index 78533cd45122..d7911a126023 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml @@ -64,17 +64,32 @@ { @:body_content = upload_gen(@parameter.Name) break; - } + } + } } - } - else if (Model.RequestBody.IsRequired) - { + else if (Model.RequestBody.IsRequired) + { + + if (Model.RequestBody.Type is CompositeType) + { + @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) + } + else + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } - else - { + } + } + else + { @:if @Model.RequestBody.Name is not None: + if (Model.RequestBody.Type is CompositeType) + { + @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) + } + else + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') + } @:else: @:body_content = None } diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml index 9e3ddbbf618e..496b19a0bee7 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml @@ -59,13 +59,27 @@ { @:# Construct body if (Model.RequestBody.IsRequired) - { + { + if (Model.RequestBody.Type is CompositeType) + { + @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) + } + else + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } - else - { + } + } + else + { @:if @Model.RequestBody.Name is not None: + if (Model.RequestBody.Type is CompositeType) + { + @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) + } + else + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') + } @:else: @:body_content = None } diff --git a/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml b/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml index 6cd57e9b0253..a97a9c8921c1 100644 --- a/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml @@ -64,17 +64,31 @@ { @:body_content = self._client.stream_upload(@parameter.Name, callback) break; - } - } - } - else if (Model.RequestBody.IsRequired) - { + } + } + } + else if (Model.RequestBody.IsRequired) + { + if (Model.RequestBody.Type is CompositeType) + { + @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) + } + else + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } - else - { + } + } + else + { @:if @Model.RequestBody.Name is not None: + if (Model.RequestBody.Type is CompositeType) + { + @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) + } + else + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') + } @:else: @:body_content = None } From 42219a602799f395860f04336d38e756f328f72e Mon Sep 17 00:00:00 2001 From: annatisch Date: Mon, 9 May 2016 11:02:26 -0700 Subject: [PATCH 03/22] Merged config and client objects --- .../AzureServiceClientTemplate.cshtml | 33 +++++++++++++------ .../ServiceClientTemplateModel.cs | 18 ++++++++++ .../ServiceClientInitTemplate.cshtml | 7 ++-- .../Templates/ServiceClientTemplate.cshtml | 23 ++++++++++--- 4 files changed, 61 insertions(+), 20 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml index 1bd45c95a8d8..383db9e00700 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml @@ -92,23 +92,37 @@ else @EmptyLine class @(Model.Name)(object): """@Model.ServiceDocument -@EmptyLine - :param config: Configuration for client. - :type config: @(Model.Name)Configuration + @EmptyLine + :ivar config: Configuration for client. + :vartype config: @(Model.Name)Configuration @if (Model.MethodGroupModels.Any()) { -@EmptyLine - foreach (var methodGroup in Model.MethodGroupModels) - { + @EmptyLine + foreach (var methodGroup in Model.MethodGroupModels) + { @: :ivar @(methodGroup.MethodGroupName.ToPythonCase()): @(methodGroup.MethodGroupName) operations @: :vartype @(methodGroup.MethodGroupName.ToPythonCase()): .operations.@(methodGroup.MethodGroupType) - } + } +} +@EmptyLine +@foreach (var property in Model.Properties) +{ +@: @ParameterWrapComment(string.Empty, ServiceClientTemplateModel.GetPropertyDocumentationString(property)) +@: @ParameterWrapComment(string.Empty, ":type " + property.Name + ": " + Model.GetPropertyDocumentationType(property.Type)) } + +@if (!Model.IsCustomBaseUri) +{ +@: :param str base_url: Service URL +} + :param str filepath: Existing config """ @EmptyLine - def __init__(self, config): + def __init__( + self, @(Model.RequiredConstructorParameters)@(Model.IsCustomBaseUri ? "" : "base_url=None, ")filepath=None): @EmptyLine - self._client = ServiceClient(@(Model.Properties.Any(p => p.Type.IsPrimaryType(KnownPrimaryType.Credentials)) ? "config.credentials" : PythonConstants.None), config) + self.config = @(Model.Name)Configuration(@(Model.ConfigConstructorParameters)@(Model.IsCustomBaseUri ? "" : "base_url, ")filepath) + self._client = ServiceClient(@(Model.Properties.Any(p => p.Type.IsPrimaryType(KnownPrimaryType.Credentials)) ? "self.config.credentials" : PythonConstants.None), self.config) @EmptyLine @if (Model.ModelTemplateModels.Any()) { @@ -121,7 +135,6 @@ else self._serialize = Serializer() self._deserialize = Deserializer(client_models) @EmptyLine - self.config = config @foreach (var methodGroup in Model.MethodGroupModels) { @:self.@(methodGroup.MethodGroupName.ToPythonCase()) = @(methodGroup.MethodGroupType)( diff --git a/AutoRest/Generators/Python/Python/TemplateModels/ServiceClientTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/ServiceClientTemplateModel.cs index 60629ea26ca2..24317c08c1fa 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/ServiceClientTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/ServiceClientTemplateModel.cs @@ -105,6 +105,24 @@ public virtual string RequiredConstructorParameters } } + public virtual string ConfigConstructorParameters + { + get + { + var configParams = new List(); + foreach (var property in this.Properties) + { + configParams.Add(property.Name.ToPythonCase()); + } + var param = string.Join(", ", configParams); + if (!param.IsNullOrEmpty()) + { + param += ", "; + } + return param; + } + } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ValueError"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "TypeError"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "str"), diff --git a/AutoRest/Generators/Python/Python/Templates/ServiceClientInitTemplate.cshtml b/AutoRest/Generators/Python/Python/Templates/ServiceClientInitTemplate.cshtml index fa51a54aafb3..d2bce3c67bd7 100644 --- a/AutoRest/Generators/Python/Python/Templates/ServiceClientInitTemplate.cshtml +++ b/AutoRest/Generators/Python/Python/Templates/ServiceClientInitTemplate.cshtml @@ -9,13 +9,10 @@ @Header("# ").TrimMultilineHeader() # -------------------------------------------------------------------------- @EmptyLine -from .@(Model.Name.ToPythonCase()) import @(Model.Name), @(Model.Name)Configuration +from .@(Model.Name.ToPythonCase()) import @(Model.Name) from .version import VERSION @EmptyLine -__all__ = [ - '@(Model.Name)', - '@(Model.Name)Configuration' -] +__all__ = ['@(Model.Name)'] @EmptyLine __version__ = VERSION @EmptyLine \ No newline at end of file diff --git a/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml b/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml index 9172b54791c7..e6ba317b1e19 100644 --- a/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml +++ b/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml @@ -86,8 +86,8 @@ else class @(Model.Name)(object): """@Model.ServiceDocument @EmptyLine - :param config: Configuration for client. - :type config: @(Model.Name)Configuration + :ivar config: Configuration for client. + :vartype config: @(Model.Name)Configuration @if (Model.MethodGroupModels.Any()) { @EmptyLine @@ -97,11 +97,25 @@ class @(Model.Name)(object): @: :vartype @(methodGroup.MethodGroupName.ToPythonCase()): .operations.@(methodGroup.MethodGroupType) } } +@EmptyLine +@foreach (var property in Model.Properties) +{ +@: @ParameterWrapComment(string.Empty, ServiceClientTemplateModel.GetPropertyDocumentationString(property)) +@: @ParameterWrapComment(string.Empty, ":type " + property.Name + ": " + Model.GetPropertyDocumentationType(property.Type)) +} + +@if (!Model.IsCustomBaseUri) +{ +@: :param str base_url: Service URL +} + :param str filepath: Existing config """ @EmptyLine - def __init__(self, config): + def __init__( + self, @(Model.RequiredConstructorParameters)@(Model.IsCustomBaseUri ? "" : "base_url=None, ")filepath=None): @EmptyLine - self._client = ServiceClient(@(Model.Properties.Any(p => p.Type.IsPrimaryType(KnownPrimaryType.Credentials)) ? "config.credentials" : PythonConstants.None), config) + self.config = @(Model.Name)Configuration(@(Model.ConfigConstructorParameters)@(Model.IsCustomBaseUri ? "" : "base_url, ")filepath) + self._client = ServiceClient(@(Model.Properties.Any(p => p.Type.IsPrimaryType(KnownPrimaryType.Credentials)) ? "self.config.credentials" : PythonConstants.None), self.config) @EmptyLine @if (Model.ModelTemplateModels.Any()) { @@ -114,7 +128,6 @@ else self._serialize = Serializer() self._deserialize = Deserializer(client_models) @EmptyLine - self.config = config @foreach (var methodGroup in Model.MethodGroupModels) { @:self.@(methodGroup.MethodGroupName.ToPythonCase()) = @(methodGroup.MethodGroupType)( From 64e0b966e758bc77a021eca3ee93187b88aadb5a Mon Sep 17 00:00:00 2001 From: annatisch Date: Mon, 9 May 2016 11:03:40 -0700 Subject: [PATCH 04/22] Removed config objects from tests --- .../azure_custom_base_uri_tests.py | 16 ++------ .../AcceptanceTests/azure_url_tests.py | 9 +---- .../AcceptanceTests/duration_tests.py | 8 +--- .../AcceptanceTests/head_tests.py | 19 ++-------- .../AcceptanceTests/lro_tests.py | 10 +---- .../AcceptanceTests/paging_tests.py | 8 +--- .../AcceptanceTests/parameter_tests.py | 26 ++++++------- .../xms_request_clientid_tests.py | 20 +++------- .../AcceptanceTests/zzz_tests.py | 6 +-- .../AcceptanceTests/array_tests.py | 10 +---- .../AcceptanceTests/bool_tests.py | 10 +---- .../AcceptanceTests/byte_tests.py | 9 +---- .../AcceptanceTests/complex_tests.py | 10 +---- .../AcceptanceTests/custom_base_uri_tests.py | 19 ++-------- .../AcceptanceTests/date_tests.py | 9 +---- .../AcceptanceTests/datetime_rfc_tests.py | 9 +---- .../AcceptanceTests/datetime_tests.py | 9 +---- .../AcceptanceTests/dictionary_tests.py | 7 +--- .../AcceptanceTests/duration_tests.py | 9 +---- .../AcceptanceTests/file_tests.py | 13 +++---- .../AcceptanceTests/form_data_tests.py | 37 ++++++------------- .../AcceptanceTests/header_tests.py | 7 +--- .../AcceptanceTests/http_tests.py | 11 ++---- .../AcceptanceTests/integer_tests.py | 9 +---- .../AcceptanceTests/model_flattening_tests.py | 10 +---- .../AcceptanceTests/number_tests.py | 9 +---- .../required_optional_tests.py | 11 +----- .../AcceptanceTests/string_tests.py | 10 +---- .../Python.Tests/AcceptanceTests/url_tests.py | 7 +--- .../AcceptanceTests/validation_tests.py | 18 ++------- .../Python.Tests/AcceptanceTests/zzz_tests.py | 10 ++--- 31 files changed, 99 insertions(+), 276 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/azure_custom_base_uri_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/azure_custom_base_uri_tests.py index c976b74e71e4..ba82c73fa906 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/azure_custom_base_uri_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/azure_custom_base_uri_tests.py @@ -48,9 +48,7 @@ from msrest.exceptions import DeserializationError, SerializationError, ClientRequestError from msrest.authentication import BasicTokenAuthentication -from autorestparameterizedhosttestclient import ( - AutoRestParameterizedHostTestClient, - AutoRestParameterizedHostTestClientConfiguration) +from autorestparameterizedhosttestclient import AutoRestParameterizedHostTestClient from autorestparameterizedhosttestclient.exceptions import ValidationError from autorestparameterizedhosttestclient.models import Error, ErrorException @@ -60,19 +58,13 @@ class CustomBaseUriTests(unittest.TestCase): def test_custom_base_uri_positive(self): cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestParameterizedHostTestClientConfiguration(cred, host="host:3000") - - config.log_level = log_level - client = AutoRestParameterizedHostTestClient(config) + client = AutoRestParameterizedHostTestClient(cred, host="host:3000") client.paths.get_empty("local") def test_custom_base_uri_negative(self): cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestParameterizedHostTestClientConfiguration(cred, host="host:3000") - - config.log_level = log_level - config.retry_policy.retries = 0 - client = AutoRestParameterizedHostTestClient(config) + client = AutoRestParameterizedHostTestClient(cred, host="host:3000") + client.config.retry_policy.retries = 0 with self.assertRaises(ClientRequestError): client.paths.get_empty("bad") diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/azure_url_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/azure_url_tests.py index 9d142ace09c9..bb9128e84f9b 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/azure_url_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/azure_url_tests.py @@ -48,9 +48,7 @@ from msrest.exceptions import DeserializationError from msrest.authentication import BasicTokenAuthentication -from microsoftazuretesturl import ( - MicrosoftAzureTestUrl, - MicrosoftAzureTestUrlConfiguration) +from microsoftazuretesturl import MicrosoftAzureTestUrl from microsoftazuretesturl.models import ErrorException, SampleResourceGroup @@ -62,10 +60,7 @@ def test_azure_url(self): client_id = str(uuid4()) cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = MicrosoftAzureTestUrlConfiguration(cred, sub_id, base_url="http://localhost:3000") - - config.log_level = log_level - client = MicrosoftAzureTestUrl(config) + client = MicrosoftAzureTestUrl(cred, sub_id, base_url="http://localhost:3000") group = client.group.get_sample_resource_group("testgoup101") self.assertEqual(group.name, "testgroup101") diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/duration_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/duration_tests.py index 92772e875a2c..44f68c78789d 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/duration_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/duration_tests.py @@ -48,9 +48,7 @@ from msrest.exceptions import DeserializationError from msrest.authentication import BasicTokenAuthentication -from autorestdurationtestservice import ( - AutoRestDurationTestService, - AutoRestDurationTestServiceConfiguration) +from autorestdurationtestservice import AutoRestDurationTestService class DurationTests(unittest.TestCase): @@ -58,9 +56,7 @@ class DurationTests(unittest.TestCase): def test_duration(self): cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestDurationTestServiceConfiguration(cred, base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestDurationTestService(config) + client = AutoRestDurationTestService(cred, base_url="http://localhost:3000") self.assertIsNone(client.duration.get_null()) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/head_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/head_tests.py index fe3ffda53688..bfbebb5e36bd 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/head_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/head_tests.py @@ -50,23 +50,15 @@ from msrest.authentication import BasicTokenAuthentication from msrestazure.azure_exceptions import CloudError, CloudErrorData -from autorestheadtestservice import ( - AutoRestHeadTestService, - AutoRestHeadTestServiceConfiguration) - -from autorestheadexceptiontestservice import ( - AutoRestHeadExceptionTestService, - AutoRestHeadExceptionTestServiceConfiguration) +from autorestheadtestservice import AutoRestHeadTestService +from autorestheadexceptiontestservice import AutoRestHeadExceptionTestService class HeadTests(unittest.TestCase): def test_head(self): cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestHeadTestServiceConfiguration(cred, base_url="http://localhost:3000") - - config.log_level = log_level - client = AutoRestHeadTestService(config) + client = AutoRestHeadTestService(cred, base_url="http://localhost:3000") self.assertTrue(client.http_success.head200()) self.assertTrue(client.http_success.head204()) @@ -77,10 +69,7 @@ class HeadExceptionTest(unittest.TestCase): def test_head_exception(self): cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestHeadExceptionTestServiceConfiguration(cred, base_url="http://localhost:3000") - - config.log_level = log_level - client = AutoRestHeadExceptionTestService(config) + client = AutoRestHeadExceptionTestService(cred, base_url="http://localhost:3000") client.head_exception.head200() client.head_exception.head204() diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/lro_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/lro_tests.py index 7e52e686bda1..39ef060fbe52 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/lro_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/lro_tests.py @@ -49,10 +49,7 @@ from msrest.authentication import BasicTokenAuthentication from msrestazure.azure_exceptions import CloudError, CloudErrorData -from autorestlongrunningoperationtestservice import ( - AutoRestLongRunningOperationTestService, - AutoRestLongRunningOperationTestServiceConfiguration) - +from autorestlongrunningoperationtestservice import AutoRestLongRunningOperationTestService from autorestlongrunningoperationtestservice.models import * class LroTests(unittest.TestCase): @@ -60,10 +57,7 @@ class LroTests(unittest.TestCase): def setUp(self): cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestLongRunningOperationTestServiceConfiguration(cred, base_url="http://localhost:3000") - - config.log_level = log_level - self.client = AutoRestLongRunningOperationTestService(config) + self.client = AutoRestLongRunningOperationTestService(cred, base_url="http://localhost:3000") self.client.config.long_running_operation_timeout = 0 self.client._client._adapter.add_hook("request", self.client._client._adapter._test_pipeline) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/paging_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/paging_tests.py index 115c5278b114..38b4c3391bda 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/paging_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/paging_tests.py @@ -49,18 +49,14 @@ from msrestazure.azure_exceptions import CloudError from msrest.authentication import BasicTokenAuthentication -from autorestpagingtestservice import ( - AutoRestPagingTestService, - AutoRestPagingTestServiceConfiguration) +from autorestpagingtestservice import AutoRestPagingTestService from autorestpagingtestservice.models import PagingGetMultiplePagesWithOffsetOptions class PagingTests(unittest.TestCase): def setUp(self): cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestPagingTestServiceConfiguration(cred, base_url="http://localhost:3000") - config.log_level = log_level - self.client = AutoRestPagingTestService(config) + self.client = AutoRestPagingTestService(cred, base_url="http://localhost:3000") self.client._client._adapter.add_hook("request", self.client._client._adapter._test_pipeline) return super(PagingTests, self).setUp() diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/parameter_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/parameter_tests.py index 56b5b87993e2..b0bac37f2bb2 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/parameter_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/parameter_tests.py @@ -49,13 +49,17 @@ sys.path.append(join(tests, "AzureSpecials")) from msrest.exceptions import DeserializationError -from autorestparametergroupingtestservice import AutoRestParameterGroupingTestServiceConfiguration, AutoRestParameterGroupingTestService -from microsoftazuretesturl import MicrosoftAzureTestUrl, MicrosoftAzureTestUrlConfiguration -from autorestdurationtestservice import AutoRestDurationTestService, AutoRestDurationTestServiceConfiguration -from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient, AutoRestAzureSpecialParametersTestClientConfiguration +from autorestparametergroupingtestservice import AutoRestParameterGroupingTestService +from microsoftazuretesturl import MicrosoftAzureTestUrl +from autorestdurationtestservice import AutoRestDurationTestService +from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient from autorestparameterizedhosttestclient.exceptions import ValidationError -from autorestparametergroupingtestservice.models import ParameterGroupingPostMultiParamGroupsSecondParamGroup, ParameterGroupingPostOptionalParameters, ParameterGroupingPostRequiredParameters, FirstParameterGroup +from autorestparametergroupingtestservice.models import ( + ParameterGroupingPostMultiParamGroupsSecondParamGroup, + ParameterGroupingPostOptionalParameters, + ParameterGroupingPostRequiredParameters, + FirstParameterGroup) from msrest.authentication import BasicTokenAuthentication @@ -71,9 +75,7 @@ def test_parameter_grouping(self): pathParameter = 'path' cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestParameterGroupingTestServiceConfiguration(cred, base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestParameterGroupingTestService(config) + client = AutoRestParameterGroupingTestService(cred, base_url="http://localhost:3000") # Valid required parameters requiredParameters = ParameterGroupingPostRequiredParameters(body=bodyParameter, path=pathParameter, custom_header=headerParameter, query=queryParameter) @@ -118,9 +120,7 @@ def test_azure_special_parameters(self): unencodedPath = 'path1/path2/path3' unencodedQuery = 'value1&q2=value2&q3=value3' cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestAzureSpecialParametersTestClient(config) + client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000") client.subscription_in_credentials.post_method_global_not_provided_valid() client.subscription_in_credentials.post_method_global_valid() @@ -154,9 +154,7 @@ def test_azure_odata(self): validSubscription = '1234-5678-9012-3456' cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestAzureSpecialParametersTestClient(config) + client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000") client.odata.get_with_filter(filter="id gt 5 and name eq 'foo'", top=10, orderby="id") diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/xms_request_clientid_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/xms_request_clientid_tests.py index f59b4bec7a24..32b33bf21a19 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/xms_request_clientid_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/xms_request_clientid_tests.py @@ -49,7 +49,7 @@ from msrest.authentication import BasicTokenAuthentication from msrestazure.azure_exceptions import CloudError, CloudErrorData -from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient, AutoRestAzureSpecialParametersTestClientConfiguration +from autorestazurespecialparameterstestclient import AutoRestAzureSpecialParametersTestClient class XmsRequestClientIdTests(unittest.TestCase): @@ -60,9 +60,7 @@ def test_xms_request_client_id(self): validClientId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' cred = BasicTokenAuthentication({"access_token":123}) - config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestAzureSpecialParametersTestClient(config) + client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000") custom_headers = {"x-ms-client-request-id": validClientId } @@ -79,9 +77,7 @@ def test_custom_named_request_id(self): expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' cred = BasicTokenAuthentication({"access_token":123}) - config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestAzureSpecialParametersTestClient(config) + client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000") response = client.header.custom_named_request_id(expectedRequestId, raw=True) self.assertEqual("123", response.response.headers.get("foo-request-id")) @@ -91,9 +87,7 @@ def test_client_request_id_in_exception(self): expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' cred = BasicTokenAuthentication({"access_token":123}) - config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestAzureSpecialParametersTestClient(config) + client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000") try: client.xms_client_request_id.get() @@ -107,10 +101,8 @@ def test_xms_request_client_id_in_client(self): expectedRequestId = '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0' cred = BasicTokenAuthentication({"access_token":123}) - config = AutoRestAzureSpecialParametersTestClientConfiguration(cred, validSubscription, base_url="http://localhost:3000") - config.log_level = log_level - config.generate_client_request_id = False - client = AutoRestAzureSpecialParametersTestClient(config) + client = AutoRestAzureSpecialParametersTestClient(cred, validSubscription, base_url="http://localhost:3000") + client.config.generate_client_request_id = False client.xms_client_request_id.get() diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/zzz_tests.py b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/zzz_tests.py index bb87f7a73531..76a9832a022b 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/zzz_tests.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/AcceptanceTests/zzz_tests.py @@ -47,7 +47,7 @@ from msrest.exceptions import DeserializationError -from autorestreportserviceforazure import AutoRestReportServiceForAzureConfiguration, AutoRestReportServiceForAzure +from autorestreportserviceforazure import AutoRestReportServiceForAzure from msrest.authentication import BasicTokenAuthentication @@ -57,9 +57,7 @@ class AcceptanceTests(unittest.TestCase): def test_ensure_coverage(self): cred = BasicTokenAuthentication({"access_token" :str(uuid4())}) - config = AutoRestReportServiceForAzureConfiguration(cred, base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestReportServiceForAzure(config) + client = AutoRestReportServiceForAzure(cred, base_url="http://localhost:3000") report = client.get_report() skipped = [k for k, v in report.items() if v == 0] diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py index 153b8635ecd7..9b14f19b3966 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py @@ -45,20 +45,14 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestswaggerbatarrayservice import ( - AutoRestSwaggerBATArrayService, - AutoRestSwaggerBATArrayServiceConfiguration) - +from autorestswaggerbatarrayservice import AutoRestSwaggerBATArrayService from autorestswaggerbatarrayservice.models import Product class ArrayTests(unittest.TestCase): def test_array(self): - - config = AutoRestSwaggerBATArrayServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestSwaggerBATArrayService(config) + client = AutoRestSwaggerBATArrayService(base_url="http://localhost:3000") self.assertListEqual([], client.array.get_empty()) self.assertIsNone(client.array.get_null()) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/bool_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/bool_tests.py index 6d3ff7c51996..6f90a1638187 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/bool_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/bool_tests.py @@ -45,19 +45,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestbooltestservice import ( - AutoRestBoolTestService, - AutoRestBoolTestServiceConfiguration) - +from autorestbooltestservice import AutoRestBoolTestService from autorestbooltestservice.models import ErrorException class BoolTests(unittest.TestCase): def test_bool(self): - - config = AutoRestBoolTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestBoolTestService(config) + client = AutoRestBoolTestService(base_url="http://localhost:3000") self.assertTrue(client.bool_model.get_true()) self.assertFalse(client.bool_model.get_false()) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/byte_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/byte_tests.py index f61c067d6324..c792f75fbe77 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/byte_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/byte_tests.py @@ -45,18 +45,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestswaggerbatbyteservice import ( - AutoRestSwaggerBATByteService, - AutoRestSwaggerBATByteServiceConfiguration) +from autorestswaggerbatbyteservice import AutoRestSwaggerBATByteService class ByteTests(unittest.TestCase): def test_byte(self): - - config = AutoRestSwaggerBATByteServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestSwaggerBATByteService(config) + client = AutoRestSwaggerBATByteService(base_url="http://localhost:3000") test_bytes = bytearray([0x0FF, 0x0FE, 0x0FD, 0x0FC, 0x0FB, 0x0FA, 0x0F9, 0x0F8, 0x0F7, 0x0F6]) client.byte.put_non_ascii(test_bytes) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py index fa4902659e39..2c1e91dd4e75 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py @@ -45,10 +45,7 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError, SerializationError, ValidationError -from autorestcomplextestservice import ( - AutoRestComplexTestService, - AutoRestComplexTestServiceConfiguration) - +from autorestcomplextestservice import AutoRestComplexTestService from autorestcomplextestservice.models import * class UTC(tzinfo): @@ -65,10 +62,7 @@ def dst(self,dt): class ComplexTests(unittest.TestCase): def test_complex(self): - - config = AutoRestComplexTestServiceConfiguration(base_url="http://localhost:3000",api_version="2015-01-01") - config.log_level = log_level - client = AutoRestComplexTestService(config) + client = AutoRestComplexTestService(base_url="http://localhost:3000",api_version="2015-01-01") # GET basic/valid basic_result = client.basic_operations.get_valid() diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/custom_base_uri_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/custom_base_uri_tests.py index 36d4ba09cf8c..38c16c2a7a14 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/custom_base_uri_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/custom_base_uri_tests.py @@ -46,30 +46,19 @@ ClientRequestError, ValidationError) -from autorestparameterizedhosttestclient import ( - AutoRestParameterizedHostTestClient, - AutoRestParameterizedHostTestClientConfiguration) - +from autorestparameterizedhosttestclient import AutoRestParameterizedHostTestClient from autorestparameterizedhosttestclient.models import Error, ErrorException class CustomBaseUriTests(unittest.TestCase): def test_custom_base_uri_positive(self): - config = AutoRestParameterizedHostTestClientConfiguration( - "host:3000") - - config.log_level = log_level - client = AutoRestParameterizedHostTestClient(config) + client = AutoRestParameterizedHostTestClient("host:3000") client.paths.get_empty("local") def test_custom_base_uri_negative(self): - config = AutoRestParameterizedHostTestClientConfiguration( - "host:3000") - - config.log_level = log_level - config.retry_policy.retries = 0 - client = AutoRestParameterizedHostTestClient(config) + client = AutoRestParameterizedHostTestClient("host:3000") + client.config.retry_policy.retries = 0 with self.assertRaises(ClientRequestError): client.paths.get_empty("bad") diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/date_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/date_tests.py index a5ef7791aa80..2b836431aeab 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/date_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/date_tests.py @@ -45,18 +45,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestdatetestservice import ( - AutoRestDateTestService, - AutoRestDateTestServiceConfiguration) +from autorestdatetestservice import AutoRestDateTestService class DateTests(unittest.TestCase): def test_date(self): - - config = AutoRestDateTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestDateTestService(config) + client = AutoRestDateTestService(base_url="http://localhost:3000") max_date = isodate.parse_date("9999-12-31T23:59:59.999999Z") min_date = isodate.parse_date("0001-01-01T00:00:00Z") diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/datetime_rfc_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/datetime_rfc_tests.py index 778e2c09585b..e5c8efe8c3be 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/datetime_rfc_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/datetime_rfc_tests.py @@ -45,18 +45,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestrfc1123datetimetestservice import ( - AutoRestRFC1123DateTimeTestService, - AutoRestRFC1123DateTimeTestServiceConfiguration) +from autorestrfc1123datetimetestservice import AutoRestRFC1123DateTimeTestService class DateTimeRfcTests(unittest.TestCase): def test_datetime_rfc(self): - - config = AutoRestRFC1123DateTimeTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestRFC1123DateTimeTestService(config) + client = AutoRestRFC1123DateTimeTestService(base_url="http://localhost:3000") self.assertIsNone(client.datetimerfc1123.get_null()) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/datetime_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/datetime_tests.py index 929df927e29b..2217a3783b47 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/datetime_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/datetime_tests.py @@ -45,18 +45,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError, SerializationError -from autorestdatetimetestservice import ( - AutoRestDateTimeTestService, - AutoRestDateTimeTestServiceConfiguration) +from autorestdatetimetestservice import AutoRestDateTimeTestService class DatetimeTests(unittest.TestCase): def test_datetime(self): - - config = AutoRestDateTimeTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestDateTimeTestService(config) + client = AutoRestDateTimeTestService(base_url="http://localhost:3000") max_date = isodate.parse_datetime("9999-12-31T23:59:59.999999Z") min_date = isodate.parse_datetime("0001-01-01T00:00:00Z") diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py index 39ec8b5000c8..fdb8cc180c83 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py @@ -42,7 +42,7 @@ from msrest.exceptions import DeserializationError -from autorestswaggerbatdictionaryservice import AutoRestSwaggerBATdictionaryService, AutoRestSwaggerBATdictionaryServiceConfiguration +from autorestswaggerbatdictionaryservice import AutoRestSwaggerBATdictionaryService from autorestswaggerbatdictionaryservice.models import Widget, ErrorException @@ -50,10 +50,7 @@ class DictionaryTests(unittest.TestCase): @classmethod def setUpClass(cls): - - config = AutoRestSwaggerBATdictionaryServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - cls.client = AutoRestSwaggerBATdictionaryService(config) + cls.client = AutoRestSwaggerBATdictionaryService(base_url="http://localhost:3000") return super(DictionaryTests, cls).setUpClass() def test_dictionary_primitive_types(self): diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/duration_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/duration_tests.py index 38367dd9c936..8ec68c0dd197 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/duration_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/duration_tests.py @@ -45,18 +45,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestdurationtestservice import ( - AutoRestDurationTestService, - AutoRestDurationTestServiceConfiguration) +from autorestdurationtestservice import AutoRestDurationTestService class DurationTests(unittest.TestCase): def test_duration(self): - - config = AutoRestDurationTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestDurationTestService(config) + client = AutoRestDurationTestService(base_url="http://localhost:3000") self.assertIsNone(client.duration.get_null()) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/file_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/file_tests.py index 900265a4ed1f..903d69f3dba2 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/file_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/file_tests.py @@ -44,17 +44,15 @@ from msrest.exceptions import DeserializationError -from autorestswaggerbatfileservice import AutoRestSwaggerBATFileService, AutoRestSwaggerBATFileServiceConfiguration +from autorestswaggerbatfileservice import AutoRestSwaggerBATFileService from autorestswaggerbatfileservice.models import ErrorException class FileTests(unittest.TestCase): def test_files(self): - - config = AutoRestSwaggerBATFileServiceConfiguration(base_url="http://localhost:3000") - config.connection.data_block_size = 1000 - client = AutoRestSwaggerBATFileService(config) + client = AutoRestSwaggerBATFileService(base_url="http://localhost:3000") + client.config.connection.data_block_size = 1000 def test_callback(data, response, progress=[0]): self.assertTrue(len(data) > 0) @@ -83,7 +81,7 @@ def test_callback(data, response, progress=[0]): sample_data = hash(data.read()) self.assertEqual(sample_data, hash(file_handle.getvalue())) - config.connection.data_block_size = 4096 + client.config.connection.data_block_size = 4096 file_length = 0 with io.BytesIO() as file_handle: stream = client.files.get_empty_file(callback=test_callback) @@ -116,8 +114,7 @@ def test_callback(data, response, progress=[0]): progress[0] += len(data) print("Downloading... {}%".format(int(progress[0]*100/total))) - config = AutoRestSwaggerBATFileServiceConfiguration(base_url="http://localhost:3000") - client = AutoRestSwaggerBATFileService(config) + client = AutoRestSwaggerBATFileService(base_url="http://localhost:3000") file_length = 0 with io.BytesIO() as file_handle: diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/form_data_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/form_data_tests.py index ea1ed1a726f9..b1fa2f0cbec9 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/form_data_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/form_data_tests.py @@ -43,7 +43,7 @@ from msrest.exceptions import DeserializationError -from autorestswaggerbatformdataservice import AutoRestSwaggerBATFormDataService, AutoRestSwaggerBATFormDataServiceConfiguration +from autorestswaggerbatformdataservice import AutoRestSwaggerBATFormDataService class FormDataTests(unittest.TestCase): @@ -63,10 +63,8 @@ def test_callback(data, response, progress = [0]): print("Progress... {}%".format(int(progress[0]*100/total))) self.assertIsNotNone(response) - config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - config.connection.data_block_size = 2 - client = AutoRestSwaggerBATFormDataService(config) + client = AutoRestSwaggerBATFormDataService(base_url="http://localhost:3000") + client.config.connection.data_block_size = 2 test_string = "Upload file test case" test_bytes = bytearray(test_string, encoding='utf-8') @@ -86,10 +84,8 @@ def test_callback(data, response, progress = [0]): print("Progress... {}%".format(int(progress[0]*100/total))) self.assertIsNotNone(response) - config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - config.connection.data_block_size = 2 - client = AutoRestSwaggerBATFormDataService(config) + client = AutoRestSwaggerBATFormDataService(base_url="http://localhost:3000") + client.config.connection.data_block_size = 2 test_string = "Upload file test case" test_bytes = bytearray(test_string, encoding='utf-8') @@ -109,10 +105,8 @@ def test_callback(data, response, progress = [0]): print("Progress... {}%".format(int(progress[0]*100/total))) self.assertIsNotNone(response) - config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - config.connection.data_block_size = 2 - client = AutoRestSwaggerBATFormDataService(config) + client = AutoRestSwaggerBATFormDataService(base_url="http://localhost:3000") + client.config.connection.data_block_size = 2 name = os.path.basename(self.dummy_file) result = io.BytesIO() @@ -131,10 +125,8 @@ def test_callback(data, response, progress = [0]): print("Progress... {}%".format(int(progress[0]*100/total))) self.assertIsNotNone(response) - config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - config.connection.data_block_size = 2 - client = AutoRestSwaggerBATFormDataService(config) + client = AutoRestSwaggerBATFormDataService(base_url="http://localhost:3000") + client.config.connection.data_block_size = 2 name = os.path.basename(self.dummy_file) result = io.BytesIO() @@ -158,10 +150,8 @@ def test_callback(data, response, progress = [0]): else: print("Uploading... {}%".format(int(progress[0]*100/total))) - config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - config.connection.data_block_size = 2 - client = AutoRestSwaggerBATFormDataService(config) + client = AutoRestSwaggerBATFormDataService(base_url="http://localhost:3000") + client.config.connection.data_block_size = 2 result = io.BytesIO() with io.BytesIO(test_bytes) as stream_data: @@ -178,10 +168,7 @@ def test_callback(data, response, progress = [0]): self.assertEqual(result.getvalue().decode(), "Test file") def test_file_body_upload_raw(self): - - config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestSwaggerBATFormDataService(config) + client = AutoRestSwaggerBATFormDataService(base_url="http://localhost:3000") test_string = "Upload file test case" test_bytes = bytearray(test_string, encoding='utf-8') diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/header_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/header_tests.py index 0a77d8dc6efe..ef5ccdbec97a 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/header_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/header_tests.py @@ -45,17 +45,14 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestswaggerbatheaderservice import AutoRestSwaggerBATHeaderService, AutoRestSwaggerBATHeaderServiceConfiguration +from autorestswaggerbatheaderservice import AutoRestSwaggerBATHeaderService from autorestswaggerbatheaderservice.models.auto_rest_swagger_bat_header_service_enums import GreyscaleColors class HeaderTests(unittest.TestCase): def test_headers(self): - - config = AutoRestSwaggerBATHeaderServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestSwaggerBATHeaderService(config) + client = AutoRestSwaggerBATHeaderService(base_url="http://localhost:3000") client.header.param_integer("positive", 1) client.header.param_integer("negative", -2) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/http_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/http_tests.py index c562609e4307..3db36e576af8 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/http_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/http_tests.py @@ -44,10 +44,7 @@ from msrest.exceptions import DeserializationError, HttpOperationError -from autoresthttpinfrastructuretestservice import ( - AutoRestHttpInfrastructureTestService, - AutoRestHttpInfrastructureTestServiceConfiguration) - +from autoresthttpinfrastructuretestservice import AutoRestHttpInfrastructureTestService from autoresthttpinfrastructuretestservice.models import ( A, B, C, D, ErrorException) @@ -55,10 +52,8 @@ class HttpTests(unittest.TestCase): def setUp(self): - config = AutoRestHttpInfrastructureTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - config.retry_policy.retries = 3 - self.client = AutoRestHttpInfrastructureTestService(config) + self.client = AutoRestHttpInfrastructureTestService(base_url="http://localhost:3000") + self.client.config.retry_policy.retries = 3 self.client._client._adapter.add_hook("request", self.client._client._adapter._test_pipeline) return super(HttpTests, self).setUp() diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/integer_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/integer_tests.py index dec0ba58003d..9b41bc6817ac 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/integer_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/integer_tests.py @@ -45,18 +45,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestintegertestservice import ( - AutoRestIntegerTestService, - AutoRestIntegerTestServiceConfiguration) +from autorestintegertestservice import AutoRestIntegerTestService class IntegerTests(unittest.TestCase): def test_integer(self): - - config = AutoRestIntegerTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestIntegerTestService(config) + client = AutoRestIntegerTestService(base_url="http://localhost:3000") client.int_model.put_max32(2147483647) # sys.maxint client.int_model.put_min32(-2147483648) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/model_flattening_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/model_flattening_tests.py index f15c8d90a2c9..bb79352d8d75 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/model_flattening_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/model_flattening_tests.py @@ -45,10 +45,7 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestresourceflatteningtestservice import ( - AutoRestResourceFlatteningTestService, - AutoRestResourceFlatteningTestServiceConfiguration) - +from autorestresourceflatteningtestservice import AutoRestResourceFlatteningTestService from autorestresourceflatteningtestservice.models import ( FlattenedProduct, ErrorException, @@ -59,10 +56,7 @@ class ModelFlatteningTests(unittest.TestCase): def setUp(self): - config = AutoRestResourceFlatteningTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - self.client = AutoRestResourceFlatteningTestService(config) - + self.client = AutoRestResourceFlatteningTestService(base_url="http://localhost:3000") return super(ModelFlatteningTests, self).setUp() def test_flattening_array(self): diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/number_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/number_tests.py index a38a02f81f0d..c3cc2bdea971 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/number_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/number_tests.py @@ -45,18 +45,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestnumbertestservice import ( - AutoRestNumberTestService, - AutoRestNumberTestServiceConfiguration) +from autorestnumbertestservice import AutoRestNumberTestService class NumberTests(unittest.TestCase): def test_numbers(self): - - config = AutoRestNumberTestServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestNumberTestService(config) + client = AutoRestNumberTestService(base_url="http://localhost:3000") client.number.put_big_float(3.402823e+20) client.number.put_small_float(3.402823e-20) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/required_optional_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/required_optional_tests.py index b8da49a9412d..28c881cf4852 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/required_optional_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/required_optional_tests.py @@ -42,10 +42,7 @@ from msrest.exceptions import DeserializationError, SerializationError, ValidationError -from autorestrequiredoptionaltestservice import ( - AutoRestRequiredOptionalTestService, - AutoRestRequiredOptionalTestServiceConfiguration) - +from autorestrequiredoptionaltestservice import AutoRestRequiredOptionalTestService from autorestrequiredoptionaltestservice.models import StringWrapper, ArrayWrapper, ClassWrapper @@ -53,14 +50,10 @@ class RequiredOptionalTests(unittest.TestCase): @classmethod def setUpClass(cls): - - config = AutoRestRequiredOptionalTestServiceConfiguration( + cls.client = AutoRestRequiredOptionalTestService( "required_path", "required_query", base_url="http://localhost:3000") - - config.log_level = log_level - cls.client = AutoRestRequiredOptionalTestService(config) return super(RequiredOptionalTests, cls).setUpClass() def test_required_optional(self): diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py index 003aebc3a916..6c4e1e2ca5af 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py @@ -46,19 +46,13 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError -from autorestswaggerbatservice import ( - AutoRestSwaggerBATService, - AutoRestSwaggerBATServiceConfiguration) - +from autorestswaggerbatservice import AutoRestSwaggerBATService from autorestswaggerbatservice.models.auto_rest_swagger_bat_service_enums import * class StringTests(unittest.TestCase): def test_string(self): - - config = AutoRestSwaggerBATServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestSwaggerBATService(config) + client = AutoRestSwaggerBATService(base_url="http://localhost:3000") self.assertIsNone(client.string.get_null()) client.string.put_null(None) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py index 3204669e8568..89d714388f71 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py @@ -43,7 +43,7 @@ from msrest.exceptions import DeserializationError, ValidationError -from autoresturltestservice import AutoRestUrlTestService, AutoRestUrlTestServiceConfiguration +from autoresturltestservice import AutoRestUrlTestService from autoresturltestservice.models.auto_rest_url_test_service_enums import UriColor @@ -51,10 +51,7 @@ class UrlTests(unittest.TestCase): @classmethod def setUpClass(cls): - - config = AutoRestUrlTestServiceConfiguration('', base_url="http://localhost:3000") - config.log_level = log_level - cls.client = AutoRestUrlTestService(config) + cls.client = AutoRestUrlTestService('', base_url="http://localhost:3000") return super(UrlTests, cls).setUpClass() def test_url_path(self): diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/validation_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/validation_tests.py index 7e1ba54e0556..2d5eb21d928e 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/validation_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/validation_tests.py @@ -45,9 +45,7 @@ from msrest.serialization import Deserializer from msrest.exceptions import DeserializationError, ValidationError -from autorestvalidationtest import ( - AutoRestValidationTest, - AutoRestValidationTestConfiguration) +from autorestvalidationtest import AutoRestValidationTest from autorestvalidationtest.models import ( Product, ConstantProduct, @@ -57,13 +55,10 @@ class ValidationTests(unittest.TestCase): def test_constant_values(self): - - config = AutoRestValidationTestConfiguration( + client = AutoRestValidationTest( "abc123", "12-34-5678", base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestValidationTest(config) client.get_with_constant_in_path() @@ -72,13 +67,10 @@ def test_constant_values(self): self.assertIsNotNone(product) def test_validation(self): - - config = AutoRestValidationTestConfiguration( + client = AutoRestValidationTest( "abc123", "12-34-5678", base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestValidationTest(config) try: client.validation_of_method_parameters("1", 100) @@ -138,12 +130,10 @@ def test_validation(self): self.assertEqual(err.rule, "max_items") self.assertEqual(err.target, "display_names") - config2 = AutoRestValidationTestConfiguration( + client2 = AutoRestValidationTest( "abc123", "abc", base_url="http://localhost:3000") - config2.log_level = log_level - client2 = AutoRestValidationTest(config2) try: client2.validation_of_method_parameters("123", 150) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/zzz_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/zzz_tests.py index 2afd6aa9c3c7..0accfbac70ed 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/zzz_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/zzz_tests.py @@ -41,17 +41,13 @@ sys.path.append(join(tests, "Report")) -from autorestreportservice import ( - AutoRestReportService, - AutoRestReportServiceConfiguration) +from autorestreportservice import AutoRestReportService class AcceptanceTests(unittest.TestCase): - def test_ensure_coverage(self): - config = AutoRestReportServiceConfiguration(base_url="http://localhost:3000") - config.log_level = log_level - client = AutoRestReportService(config) + def test_ensure_coverage(self): + client = AutoRestReportService(base_url="http://localhost:3000") report = client.get_report() # Add tests that wont be supported due to the nature of Python here From 71f8973bb7943494952ee7bd359f825c2b2099ee Mon Sep 17 00:00:00 2001 From: annatisch Date: Mon, 9 May 2016 17:24:40 -0700 Subject: [PATCH 05/22] support for unix timestamps --- .../AcceptanceTests/integer_tests.py | 10 +- .../Python/Python/ClientModelExtensions.cs | 8 +- .../Python/Python/PythonCodeNamer.cs | 2 +- .../Python/msrest/msrest/serialization.py | 114 +++++++++++++++--- 4 files changed, 114 insertions(+), 20 deletions(-) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/integer_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/integer_tests.py index 9b41bc6817ac..d1b000739c9d 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/integer_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/integer_tests.py @@ -30,7 +30,7 @@ import isodate import tempfile import json -from datetime import date, datetime, timedelta +from datetime import date, datetime, timedelta, tzinfo import os from os.path import dirname, pardir, join, realpath, sep, pardir @@ -69,6 +69,14 @@ def test_integer(self): #client.int_model.get_underflow_int32() #client.int_model.get_underflow_int64() + unix_date = datetime(year=2016, month=4, day=13) + client.int_model.put_unix_time_date(unix_date) + self.assertEqual(unix_date.utctimetuple(), client.int_model.get_unix_time().utctimetuple()) + self.assertIsNone(client.int_model.get_null_unix_time()) + + with self.assertRaises(DeserializationError): + client.int_model.get_invalid_unix_time() + if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/AutoRest/Generators/Python/Python/ClientModelExtensions.cs b/AutoRest/Generators/Python/Python/ClientModelExtensions.cs index d43e67525c2d..330d8aef564c 100644 --- a/AutoRest/Generators/Python/Python/ClientModelExtensions.cs +++ b/AutoRest/Generators/Python/Python/ClientModelExtensions.cs @@ -147,6 +147,11 @@ public static string ToPythonRuntimeTypeString(this IType type) { return "duration"; } + + if (known.Type == KnownPrimaryType.UnixTime) + { + return "unix-time"; + } } var sequenceType = type as SequenceType; @@ -246,7 +251,8 @@ public static string GetPythonSerializationType(IType type) { { KnownPrimaryType.DateTime, "iso-8601" }, { KnownPrimaryType.DateTimeRfc1123, "rfc-1123" }, - { KnownPrimaryType.TimeSpan, "duration" } + { KnownPrimaryType.TimeSpan, "duration" }, + { KnownPrimaryType.UnixTime, "unix-time" } }; PrimaryType primaryType = type as PrimaryType; if (primaryType != null) diff --git a/AutoRest/Generators/Python/Python/PythonCodeNamer.cs b/AutoRest/Generators/Python/Python/PythonCodeNamer.cs index 11ae0801acce..bcc2eceecf75 100644 --- a/AutoRest/Generators/Python/Python/PythonCodeNamer.cs +++ b/AutoRest/Generators/Python/Python/PythonCodeNamer.cs @@ -378,7 +378,7 @@ private static IType NormalizePrimaryType(PrimaryType primaryType) } else if (primaryType.Type == KnownPrimaryType.UnixTime) { - primaryType.Name = "long"; + primaryType.Name = "datetime"; } else if (primaryType.Type == KnownPrimaryType.Object) // Revisit here { diff --git a/ClientRuntimes/Python/msrest/msrest/serialization.py b/ClientRuntimes/Python/msrest/msrest/serialization.py index 4675cd6aacee..f1bd12f91c93 100644 --- a/ClientRuntimes/Python/msrest/msrest/serialization.py +++ b/ClientRuntimes/Python/msrest/msrest/serialization.py @@ -25,10 +25,13 @@ # -------------------------------------------------------------------------- from base64 import b64decode, b64encode +import calendar import datetime import decimal from enum import Enum +import importlib import json +import logging import re try: from urllib import quote @@ -49,6 +52,31 @@ except NameError: basestring = str +_LOGGER = logging.getLogger(__name__) + + +class UTC(datetime.tzinfo): + """Time Zone info for handling UTC""" + + def utcoffset(self, dt): + """UTF offset for UTC is 0.""" + return datetime.timedelta(0) + + def tzname(self, dt): + """Timestamp representation.""" + return "Z" + + def dst(self, dt): + """No daylight saving for UTC.""" + return datetime.timedelta(hours=1) + + +try: + from datetime import timezone + TZ_UTC = timezone.utc +except ImportError: + TZ_UTC = UTC() + class Model(object): """Mixin for all client request body/response body models to support @@ -112,6 +140,24 @@ def _classify(cls, response, objects): raise TypeError("Object cannot be classified futher.") +def _convert_to_datatype(params, localtype): + """Convert a dict-like object to the given datatype + """ + return _recursive_convert_to_datatype(params, localtype.__name__, importlib.import_module('..', localtype.__module__)) + + +def _recursive_convert_to_datatype(params, str_localtype, models_module): + """Convert a dict-like object to the given datatype + """ + if isinstance(params, list): + return [_recursive_convert_to_datatype(data, str_localtype[1:-1], models_module) for data in params] + localtype = getattr(models_module, str_localtype) if hasattr(models_module, str_localtype) else None + if not localtype: + return params + result = {key: _recursive_convert_to_datatype(params[key], localtype._attribute_map[key]['type'], models_module) for key in params} + return localtype(**result) + + class Serializer(object): """Request object model serializer.""" @@ -139,6 +185,7 @@ def __init__(self): self.serialize_type = { 'iso-8601': Serializer.serialize_iso, 'rfc-1123': Serializer.serialize_rfc, + 'unix-time': Serializer.serialize_unix, 'duration': Serializer.serialize_duration, 'date': Serializer.serialize_date, 'decimal': Serializer.serialize_decimal, @@ -235,7 +282,11 @@ def body(self, data, data_type, **kwargs): """ if data is None: raise ValidationError("required", "body", True) - return self._serialize(data, data_type, **kwargs) + elif isinstance(data_type, str): + return self._serialize(data, data_type, **kwargs) + elif not isinstance(data, data_type): + data = _convert_to_datatype(data, data_type) + return self._serialize(data, data_type.__name__, **kwargs) def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. @@ -527,6 +578,8 @@ def serialize_rfc(attr, **kwargs): :raises: TypeError if format invalid. """ try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") @@ -546,9 +599,14 @@ def serialize_iso(attr, **kwargs): """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) - try: - utc = attr.utctimetuple() + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError: + raise TypeError( + "ISO-8601 object must be valid Datetime object.") if utc.tm_year > 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") @@ -561,6 +619,24 @@ def serialize_iso(attr, **kwargs): msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) + @staticmethod + def serialize_unix(attr, **kwargs): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises: SerializationError if format invalid + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError: + raise TypeError("Unix time object must be valid Datetime object.") + class Deserializer(object): """Response object model deserializer. @@ -579,6 +655,7 @@ def __init__(self, classes={}): self.deserialize_type = { 'iso-8601': Deserializer.deserialize_iso, 'rfc-1123': Deserializer.deserialize_rfc, + 'unix-time': Deserializer.deserialize_unix, 'duration': Deserializer.deserialize_duration, 'date': Deserializer.deserialize_date, 'decimal': Deserializer.deserialize_decimal, @@ -958,7 +1035,8 @@ def deserialize_rfc(attr): try: date_obj = datetime.datetime.strptime( attr, "%a, %d %b %Y %H:%M:%S %Z") - date_obj = date_obj.replace(tzinfo=UTC()) + if not date_obj.tzinfo: + date_obj = date_obj.replace(tzinfo=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise_with_traceback(DeserializationError, msg, err) @@ -1000,18 +1078,20 @@ def deserialize_iso(attr): else: return date_obj + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(hours=0, minutes=0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" + :param int attr: Object to be serialized. + :rtype: Datetime + :raises: DeserializationError if format invalid + """ + try: + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise_with_traceback(DeserializationError, msg, err) + else: + return date_obj - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(0) From c951cb8bfa900149c35ff63785cef2cb87d3b34e Mon Sep 17 00:00:00 2001 From: annatisch Date: Mon, 9 May 2016 17:26:47 -0700 Subject: [PATCH 06/22] regenerated python tests --- .../autorestdurationtestservice/__init__.py | 7 +-- .../auto_rest_duration_test_service.py | 27 +++++++++-- .../__init__.py | 7 +-- ...to_rest_parameter_grouping_test_service.py | 27 +++++++++-- .../autorestreportserviceforazure/__init__.py | 7 +-- .../auto_rest_report_service_for_azure.py | 27 +++++++++-- .../__init__.py | 7 +-- ...o_rest_resource_flattening_test_service.py | 29 +++++++++--- .../__init__.py | 7 +-- ...st_azure_special_parameters_test_client.py | 33 +++++++++++-- .../__init__.py | 7 +-- ...uto_rest_parameterized_host_test_client.py | 29 ++++++++++-- .../Head/autorestheadtestservice/__init__.py | 7 +-- .../auto_rest_head_test_service.py | 27 +++++++++-- .../__init__.py | 7 +-- .../auto_rest_head_exception_test_service.py | 27 +++++++++-- .../__init__.py | 7 +-- ...est_long_running_operation_test_service.py | 27 +++++++++-- .../lr_os_custom_header_operations.py | 8 ++-- .../operations/lr_os_operations.py | 46 +++++++++---------- .../operations/lro_retrys_operations.py | 8 ++-- .../operations/lrosa_ds_operations.py | 36 +++++++-------- .../autorestpagingtestservice/__init__.py | 7 +-- .../auto_rest_paging_test_service.py | 27 +++++++++-- .../storagemanagementclient/__init__.py | 7 +-- .../operations/storage_accounts_operations.py | 8 ++-- .../storage_management_client.py | 33 +++++++++++-- .../microsoftazuretesturl/__init__.py | 7 +-- .../microsoft_azure_test_url.py | 31 +++++++++++-- .../__init__.py | 7 +-- .../auto_rest_swagger_bat_array_service.py | 14 ++++-- .../autorestbooltestservice/__init__.py | 7 +-- .../auto_rest_bool_test_service.py | 14 ++++-- .../autorestswaggerbatbyteservice/__init__.py | 7 +-- .../auto_rest_swagger_bat_byte_service.py | 14 ++++-- .../autorestcomplextestservice/__init__.py | 7 +-- .../auto_rest_complex_test_service.py | 16 +++++-- .../operations/array.py | 4 +- .../operations/basic_operations.py | 2 +- .../operations/dictionary.py | 4 +- .../operations/inheritance.py | 2 +- .../operations/polymorphicrecursive.py | 2 +- .../operations/polymorphism.py | 4 +- .../operations/primitive.py | 22 ++++----- .../operations/readonlyproperty.py | 2 +- .../autorestdatetestservice/__init__.py | 7 +-- .../auto_rest_date_test_service.py | 14 ++++-- .../autorestdatetimetestservice/__init__.py | 7 +-- .../auto_rest_date_time_test_service.py | 14 ++++-- .../__init__.py | 7 +-- ...uto_rest_rfc1123_date_time_test_service.py | 14 ++++-- .../__init__.py | 7 +-- ...uto_rest_swagger_ba_tdictionary_service.py | 14 ++++-- .../autorestdurationtestservice/__init__.py | 7 +-- .../auto_rest_duration_test_service.py | 14 ++++-- .../autorestswaggerbatfileservice/__init__.py | 7 +-- .../auto_rest_swagger_bat_file_service.py | 14 ++++-- .../__init__.py | 7 +-- ...auto_rest_swagger_bat_form_data_service.py | 14 ++++-- .../autorestintegertestservice/__init__.py | 7 +-- .../auto_rest_integer_test_service.py | 14 ++++-- .../operations/int_model.py | 16 +++---- .../autorestnumbertestservice/__init__.py | 7 +-- .../auto_rest_number_test_service.py | 14 ++++-- .../autorestswaggerbatservice/__init__.py | 7 +-- .../auto_rest_swagger_bat_service.py | 14 ++++-- .../__init__.py | 7 +-- ...uto_rest_parameterized_host_test_client.py | 16 +++++-- .../__init__.py | 7 +-- ...t_parameterized_custom_host_test_client.py | 18 ++++++-- .../__init__.py | 7 +-- .../auto_rest_swagger_bat_header_service.py | 14 ++++-- .../__init__.py | 7 +-- ...o_rest_http_infrastructure_test_service.py | 14 ++++-- .../__init__.py | 7 +-- ...o_rest_resource_flattening_test_service.py | 22 +++++---- .../autorestparameterflattening/__init__.py | 7 +-- .../auto_rest_parameter_flattening.py | 14 ++++-- .../operations/availability_sets.py | 2 +- .../Report/autorestreportservice/__init__.py | 7 +-- .../auto_rest_report_service.py | 14 ++++-- .../__init__.py | 7 +-- ...uto_rest_required_optional_test_service.py | 20 ++++++-- .../operations/explicit.py | 20 ++++---- .../Url/autoresturltestservice/__init__.py | 7 +-- .../auto_rest_url_test_service.py | 19 ++++++-- .../operations/paths.py | 4 +- .../autorestvalidationtest/__init__.py | 7 +-- .../auto_rest_validation_test.py | 22 ++++++--- .../storagemanagementclient/__init__.py | 7 +-- .../operations/storage_accounts_operations.py | 8 ++-- .../storage_management_client.py | 33 +++++++++++-- .../Python/swaggerpetstore/__init__.py | 7 +-- .../swaggerpetstore/swagger_petstore.py | 24 ++++++---- 94 files changed, 745 insertions(+), 491 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/__init__.py index 2b089964f917..4ec26f57486d 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_duration_test_service import AutoRestDurationTestService, AutoRestDurationTestServiceConfiguration +from .auto_rest_duration_test_service import AutoRestDurationTestService from .version import VERSION -__all__ = [ - 'AutoRestDurationTestService', - 'AutoRestDurationTestServiceConfiguration' -] +__all__ = ['AutoRestDurationTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py index 668b135381e1..532c33c57375 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py @@ -63,21 +63,38 @@ def __init__( class AutoRestDurationTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestDurationTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestDurationTestServiceConfiguration :ivar duration: Duration operations :vartype duration: .operations.DurationOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestDurationTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.duration = DurationOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/__init__.py index 3ebb42c766ef..375abf70c5f9 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_parameter_grouping_test_service import AutoRestParameterGroupingTestService, AutoRestParameterGroupingTestServiceConfiguration +from .auto_rest_parameter_grouping_test_service import AutoRestParameterGroupingTestService from .version import VERSION -__all__ = [ - 'AutoRestParameterGroupingTestService', - 'AutoRestParameterGroupingTestServiceConfiguration' -] +__all__ = ['AutoRestParameterGroupingTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/auto_rest_parameter_grouping_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/auto_rest_parameter_grouping_test_service.py index 13e63f9569c8..15004842908e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/auto_rest_parameter_grouping_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/auto_rest_parameter_grouping_test_service.py @@ -63,21 +63,38 @@ def __init__( class AutoRestParameterGroupingTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestParameterGroupingTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestParameterGroupingTestServiceConfiguration :ivar parameter_grouping: ParameterGrouping operations :vartype parameter_grouping: .operations.ParameterGroupingOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestParameterGroupingTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.parameter_grouping = ParameterGroupingOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/__init__.py index 3b5e0464d00a..c038eb8a5dcb 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_report_service_for_azure import AutoRestReportServiceForAzure, AutoRestReportServiceForAzureConfiguration +from .auto_rest_report_service_for_azure import AutoRestReportServiceForAzure from .version import VERSION -__all__ = [ - 'AutoRestReportServiceForAzure', - 'AutoRestReportServiceForAzureConfiguration' -] +__all__ = ['AutoRestReportServiceForAzure'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py index c02088e43b1a..624bcd552166 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py @@ -64,19 +64,36 @@ def __init__( class AutoRestReportServiceForAzure(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestReportServiceForAzureConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestReportServiceForAzureConfiguration + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestReportServiceForAzureConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config def get_report( self, custom_headers={}, raw=False, **operation_config): diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/__init__.py index a81829bba4a6..f01b0f4d2710 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_resource_flattening_test_service import AutoRestResourceFlatteningTestService, AutoRestResourceFlatteningTestServiceConfiguration +from .auto_rest_resource_flattening_test_service import AutoRestResourceFlatteningTestService from .version import VERSION -__all__ = [ - 'AutoRestResourceFlatteningTestService', - 'AutoRestResourceFlatteningTestServiceConfiguration' -] +__all__ = ['AutoRestResourceFlatteningTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py index 74f09db9d340..aab82f8862e4 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py @@ -64,19 +64,36 @@ def __init__( class AutoRestResourceFlatteningTestService(object): """Resource Flattening for AutoRest - :param config: Configuration for client. - :type config: AutoRestResourceFlatteningTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestResourceFlatteningTestServiceConfiguration + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestResourceFlatteningTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config def put_array( self, resource_array=None, custom_headers={}, raw=False, **operation_config): @@ -312,7 +329,7 @@ def put_resource_collection( # Construct body if resource_complex_object is not None: - body_content = self._serialize.body(resource_complex_object, 'ResourceCollection') + body_content = self._serialize.body(resource_complex_object, models.ResourceCollection) else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/__init__.py index 99cf572f3c11..17626ce777bc 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_azure_special_parameters_test_client import AutoRestAzureSpecialParametersTestClient, AutoRestAzureSpecialParametersTestClientConfiguration +from .auto_rest_azure_special_parameters_test_client import AutoRestAzureSpecialParametersTestClient from .version import VERSION -__all__ = [ - 'AutoRestAzureSpecialParametersTestClient', - 'AutoRestAzureSpecialParametersTestClientConfiguration' -] +__all__ = ['AutoRestAzureSpecialParametersTestClient'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/auto_rest_azure_special_parameters_test_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/auto_rest_azure_special_parameters_test_client.py index 95f2d47d0fb5..27217a362fa9 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/auto_rest_azure_special_parameters_test_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/auto_rest_azure_special_parameters_test_client.py @@ -84,8 +84,8 @@ def __init__( class AutoRestAzureSpecialParametersTestClient(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestAzureSpecialParametersTestClientConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestAzureSpecialParametersTestClientConfiguration :ivar xms_client_request_id: XMsClientRequestId operations :vartype xms_client_request_id: .operations.XMsClientRequestIdOperations @@ -103,17 +103,40 @@ class AutoRestAzureSpecialParametersTestClient(object): :vartype odata: .operations.OdataOperations :ivar header: Header operations :vartype header: .operations.HeaderOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :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 api_version: The api version, which appears in the query, the + value is always '2015-07-01-preview' + :type api_version: str + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, subscription_id, api_version='2015-07-01-preview', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestAzureSpecialParametersTestClientConfiguration(credentials, subscription_id, api_version, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.xms_client_request_id = XMsClientRequestIdOperations( self._client, self.config, self._serialize, self._deserialize) self.subscription_in_credentials = SubscriptionInCredentialsOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/__init__.py index ba883e5e5ac4..55019b8878d2 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient, AutoRestParameterizedHostTestClientConfiguration +from .auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient from .version import VERSION -__all__ = [ - 'AutoRestParameterizedHostTestClient', - 'AutoRestParameterizedHostTestClientConfiguration' -] +__all__ = ['AutoRestParameterizedHostTestClient'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py index 79e862f82db7..f6902e55c686 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py @@ -69,21 +69,40 @@ def __init__( class AutoRestParameterizedHostTestClient(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestParameterizedHostTestClientConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestParameterizedHostTestClientConfiguration :ivar paths: Paths operations :vartype paths: .operations.PathsOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param host: A string value that is used as a global part of the + parameterized host + :type host: str + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, host, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestParameterizedHostTestClientConfiguration(credentials, host, accept_language, long_running_operation_retry_timeout, generate_client_request_id, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.paths = PathsOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/__init__.py index ce653b3b55a8..6413c9114166 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_head_test_service import AutoRestHeadTestService, AutoRestHeadTestServiceConfiguration +from .auto_rest_head_test_service import AutoRestHeadTestService from .version import VERSION -__all__ = [ - 'AutoRestHeadTestService', - 'AutoRestHeadTestServiceConfiguration' -] +__all__ = ['AutoRestHeadTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/auto_rest_head_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/auto_rest_head_test_service.py index fc86a3308cb2..786fdce1b810 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/auto_rest_head_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/auto_rest_head_test_service.py @@ -62,21 +62,38 @@ def __init__( class AutoRestHeadTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestHeadTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestHeadTestServiceConfiguration :ivar http_success: HttpSuccess operations :vartype http_success: .operations.HttpSuccessOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestHeadTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.http_success = HttpSuccessOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/__init__.py index 3ab0679689dd..0e63032ad698 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_head_exception_test_service import AutoRestHeadExceptionTestService, AutoRestHeadExceptionTestServiceConfiguration +from .auto_rest_head_exception_test_service import AutoRestHeadExceptionTestService from .version import VERSION -__all__ = [ - 'AutoRestHeadExceptionTestService', - 'AutoRestHeadExceptionTestServiceConfiguration' -] +__all__ = ['AutoRestHeadExceptionTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/auto_rest_head_exception_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/auto_rest_head_exception_test_service.py index d9745572729e..0a040dc195f2 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/auto_rest_head_exception_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/auto_rest_head_exception_test_service.py @@ -62,21 +62,38 @@ def __init__( class AutoRestHeadExceptionTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestHeadExceptionTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestHeadExceptionTestServiceConfiguration :ivar head_exception: HeadException operations :vartype head_exception: .operations.HeadExceptionOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestHeadExceptionTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.head_exception = HeadExceptionOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/__init__.py index 8186c26cc15c..eb1578e8c7c9 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_long_running_operation_test_service import AutoRestLongRunningOperationTestService, AutoRestLongRunningOperationTestServiceConfiguration +from .auto_rest_long_running_operation_test_service import AutoRestLongRunningOperationTestService from .version import VERSION -__all__ = [ - 'AutoRestLongRunningOperationTestService', - 'AutoRestLongRunningOperationTestServiceConfiguration' -] +__all__ = ['AutoRestLongRunningOperationTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/auto_rest_long_running_operation_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/auto_rest_long_running_operation_test_service.py index be1ddc0cc63c..10be2f337715 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/auto_rest_long_running_operation_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/auto_rest_long_running_operation_test_service.py @@ -66,8 +66,8 @@ def __init__( class AutoRestLongRunningOperationTestService(object): """Long-running Operation for AutoRest - :param config: Configuration for client. - :type config: AutoRestLongRunningOperationTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestLongRunningOperationTestServiceConfiguration :ivar lr_os: LROs operations :vartype lr_os: .operations.LROsOperations @@ -77,17 +77,34 @@ class AutoRestLongRunningOperationTestService(object): :vartype lrosa_ds: .operations.LROSADsOperations :ivar lr_os_custom_header: LROsCustomHeader operations :vartype lr_os_custom_header: .operations.LROsCustomHeaderOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestLongRunningOperationTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.lr_os = LROsOperations( self._client, self.config, self._serialize, self._deserialize) self.lro_retrys = LRORetrysOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py index 96ade6d8e3ad..521b8b7e132e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py @@ -74,7 +74,7 @@ def put_async_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -168,7 +168,7 @@ def put201_creating_succeeded200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -256,7 +256,7 @@ def post202_retry200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -339,7 +339,7 @@ def post_async_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py index 4a078a8a86f8..743e4acfeda1 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py @@ -71,7 +71,7 @@ def put200_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -156,7 +156,7 @@ def put200_succeeded_no_state( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -241,7 +241,7 @@ def put202_retry200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -327,7 +327,7 @@ def put201_creating_succeeded200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -415,7 +415,7 @@ def put200_updating_succeeded204( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -501,7 +501,7 @@ def put201_creating_failed200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -589,7 +589,7 @@ def put200_acceptedcanceled200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -674,7 +674,7 @@ def put_no_header_in_retry( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -765,7 +765,7 @@ def put_async_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -858,7 +858,7 @@ def put_async_no_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -950,7 +950,7 @@ def put_async_retry_failed( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1043,7 +1043,7 @@ def put_async_no_retrycanceled( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1134,7 +1134,7 @@ def put_async_no_header_in_retry( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1221,7 +1221,7 @@ def put_non_resource( # Construct body if sku is not None: - body_content = self._serialize.body(sku, 'Sku') + body_content = self._serialize.body(sku, models.Sku) else: body_content = None @@ -1303,7 +1303,7 @@ def put_async_non_resource( # Construct body if sku is not None: - body_content = self._serialize.body(sku, 'Sku') + body_content = self._serialize.body(sku, models.Sku) else: body_content = None @@ -1386,7 +1386,7 @@ def put_sub_resource( # Construct body if product is not None: - body_content = self._serialize.body(product, 'SubProduct') + body_content = self._serialize.body(product, models.SubProduct) else: body_content = None @@ -1469,7 +1469,7 @@ def put_async_sub_resource( # Construct body if product is not None: - body_content = self._serialize.body(product, 'SubProduct') + body_content = self._serialize.body(product, models.SubProduct) else: body_content = None @@ -2549,7 +2549,7 @@ def post202_retry200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -2631,7 +2631,7 @@ def post202_no_retry204( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -2723,7 +2723,7 @@ def post_async_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -2816,7 +2816,7 @@ def post_async_no_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -2908,7 +2908,7 @@ def post_async_retry_failed( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -2991,7 +2991,7 @@ def post_async_retrycanceled( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py index 786c3c3bf6d7..899a55b89635 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py @@ -73,7 +73,7 @@ def put201_creating_succeeded200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -161,7 +161,7 @@ def put_async_relative_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -483,7 +483,7 @@ def post202_retry200( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -565,7 +565,7 @@ def post_async_relative_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py index a211b6975e70..d2de0cff4bd8 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py @@ -70,7 +70,7 @@ def put_non_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -156,7 +156,7 @@ def put_non_retry201_creating400( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -242,7 +242,7 @@ def put_non_retry201_creating400_invalid_json( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -329,7 +329,7 @@ def put_async_relative_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -629,7 +629,7 @@ def post_non_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -708,7 +708,7 @@ def post202_non_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -789,7 +789,7 @@ def post_async_relative_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -871,7 +871,7 @@ def put_error201_no_provisioning_state_payload( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -959,7 +959,7 @@ def put_async_relative_retry_no_status( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1052,7 +1052,7 @@ def put_async_relative_retry_no_status_payload( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1280,7 +1280,7 @@ def post202_no_location( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1362,7 +1362,7 @@ def post_async_relative_retry_no_payload( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1444,7 +1444,7 @@ def put200_invalid_json( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1529,7 +1529,7 @@ def put_async_relative_retry_invalid_header( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1622,7 +1622,7 @@ def put_async_relative_retry_invalid_json_polling( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -1927,7 +1927,7 @@ def post202_retry_invalid_header( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -2008,7 +2008,7 @@ def post_async_relative_retry_invalid_header( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None @@ -2091,7 +2091,7 @@ def post_async_relative_retry_invalid_json_polling( # Construct body if product is not None: - body_content = self._serialize.body(product, 'Product') + body_content = self._serialize.body(product, models.Product) else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/__init__.py index 40efea1e6c76..68708b4282ef 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_paging_test_service import AutoRestPagingTestService, AutoRestPagingTestServiceConfiguration +from .auto_rest_paging_test_service import AutoRestPagingTestService from .version import VERSION -__all__ = [ - 'AutoRestPagingTestService', - 'AutoRestPagingTestServiceConfiguration' -] +__all__ = ['AutoRestPagingTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/auto_rest_paging_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/auto_rest_paging_test_service.py index e3cf9310642e..b1bb993344a4 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/auto_rest_paging_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/auto_rest_paging_test_service.py @@ -63,21 +63,38 @@ def __init__( class AutoRestPagingTestService(object): """Long-running Operation for AutoRest - :param config: Configuration for client. - :type config: AutoRestPagingTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestPagingTestServiceConfiguration :ivar paging: Paging operations :vartype paging: .operations.PagingOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = AutoRestPagingTestServiceConfiguration(credentials, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.paging = PagingOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/__init__.py index 928015217d6c..0854715e0c10 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .storage_management_client import StorageManagementClient, StorageManagementClientConfiguration +from .storage_management_client import StorageManagementClient from .version import VERSION -__all__ = [ - 'StorageManagementClient', - 'StorageManagementClientConfiguration' -] +__all__ = ['StorageManagementClient'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py index 2250ab10c146..4c6883792aae 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py @@ -78,7 +78,7 @@ def check_name_availability( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + body_content = self._serialize.body(account_name, models.StorageAccountCheckNameAvailabilityParameters) # Construct and send request request = self._client.post(url, query_parameters) @@ -155,7 +155,7 @@ def create( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') + body_content = self._serialize.body(parameters, models.StorageAccountCreateParameters) # Construct and send request def long_running_send(): @@ -386,7 +386,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + body_content = self._serialize.body(parameters, models.StorageAccountUpdateParameters) # Construct and send request request = self._client.patch(url, query_parameters) @@ -656,7 +656,7 @@ def regenerate_key( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + body_content = self._serialize.body(regenerate_key, models.StorageAccountRegenerateKeyParameters) # Construct and send request request = self._client.post(url, query_parameters) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/storage_management_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/storage_management_client.py index 1334ec94142e..68f581fd8166 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/storage_management_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/storage_management_client.py @@ -78,24 +78,47 @@ def __init__( class StorageManagementClient(object): """StorageManagementClient - :param config: Configuration for client. - :type config: StorageManagementClientConfiguration + :ivar config: Configuration for client. + :vartype config: StorageManagementClientConfiguration :ivar storage_accounts: StorageAccounts operations :vartype storage_accounts: .operations.StorageAccountsOperations :ivar usage: Usage operations :vartype usage: .operations.UsageOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :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 api_version: Client Api Version. + :type api_version: str + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, subscription_id, api_version='2015-05-01-preview', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = StorageManagementClientConfiguration(credentials, subscription_id, api_version, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.storage_accounts = StorageAccountsOperations( self._client, self.config, self._serialize, self._deserialize) self.usage = UsageOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/__init__.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/__init__.py index 1841a70993a8..fb1c1642d285 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/__init__.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .microsoft_azure_test_url import MicrosoftAzureTestUrl, MicrosoftAzureTestUrlConfiguration +from .microsoft_azure_test_url import MicrosoftAzureTestUrl from .version import VERSION -__all__ = [ - 'MicrosoftAzureTestUrl', - 'MicrosoftAzureTestUrlConfiguration' -] +__all__ = ['MicrosoftAzureTestUrl'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py index d16f3f25706a..7283782c9388 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py @@ -75,21 +75,42 @@ def __init__( class MicrosoftAzureTestUrl(object): """Some cool documentation. - :param config: Configuration for client. - :type config: MicrosoftAzureTestUrlConfiguration + :ivar config: Configuration for client. + :vartype config: MicrosoftAzureTestUrlConfiguration :ivar group: Group operations :vartype group: .operations.GroupOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription Id. + :type subscription_id: str + :param api_version: API Version with value '2014-04-01-preview'. + :type api_version: str + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, subscription_id, api_version='2014-04-01-preview', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = MicrosoftAzureTestUrlConfiguration(credentials, subscription_id, api_version, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.group = GroupOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/__init__.py index aaf980709eff..1aef76714e64 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService, AutoRestSwaggerBATArrayServiceConfiguration +from .auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService from .version import VERSION -__all__ = [ - 'AutoRestSwaggerBATArrayService', - 'AutoRestSwaggerBATArrayServiceConfiguration' -] +__all__ = ['AutoRestSwaggerBATArrayService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/auto_rest_swagger_bat_array_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/auto_rest_swagger_bat_array_service.py index 8ebdaa19bfa3..5708ff6c6721 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/auto_rest_swagger_bat_array_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/auto_rest_swagger_bat_array_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestSwaggerBATArrayService(object): """Test Infrastructure for AutoRest Swagger BAT - :param config: Configuration for client. - :type config: AutoRestSwaggerBATArrayServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestSwaggerBATArrayServiceConfiguration :ivar array: Array operations :vartype array: .operations.Array + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestSwaggerBATArrayServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.array = Array( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/__init__.py index 1a9ee6215ad6..b5af29ff2dae 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_bool_test_service import AutoRestBoolTestService, AutoRestBoolTestServiceConfiguration +from .auto_rest_bool_test_service import AutoRestBoolTestService from .version import VERSION -__all__ = [ - 'AutoRestBoolTestService', - 'AutoRestBoolTestServiceConfiguration' -] +__all__ = ['AutoRestBoolTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/auto_rest_bool_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/auto_rest_bool_test_service.py index 4b761abb6106..362fed213666 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/auto_rest_bool_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/auto_rest_bool_test_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestBoolTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestBoolTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestBoolTestServiceConfiguration :ivar bool_model: BoolModel operations :vartype bool_model: .operations.BoolModel + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestBoolTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.bool_model = BoolModel( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/__init__.py index 96f86be7bcf6..5db23a411c53 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_swagger_bat_byte_service import AutoRestSwaggerBATByteService, AutoRestSwaggerBATByteServiceConfiguration +from .auto_rest_swagger_bat_byte_service import AutoRestSwaggerBATByteService from .version import VERSION -__all__ = [ - 'AutoRestSwaggerBATByteService', - 'AutoRestSwaggerBATByteServiceConfiguration' -] +__all__ = ['AutoRestSwaggerBATByteService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/auto_rest_swagger_bat_byte_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/auto_rest_swagger_bat_byte_service.py index 642657c97d75..e95752ae8ff2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/auto_rest_swagger_bat_byte_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/auto_rest_swagger_bat_byte_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestSwaggerBATByteService(object): """Test Infrastructure for AutoRest Swagger BAT - :param config: Configuration for client. - :type config: AutoRestSwaggerBATByteServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestSwaggerBATByteServiceConfiguration :ivar byte: Byte operations :vartype byte: .operations.Byte + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestSwaggerBATByteServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.byte = Byte( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/__init__.py index 88a5faf1c85e..e1df7688a132 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_complex_test_service import AutoRestComplexTestService, AutoRestComplexTestServiceConfiguration +from .auto_rest_complex_test_service import AutoRestComplexTestService from .version import VERSION -__all__ = [ - 'AutoRestComplexTestService', - 'AutoRestComplexTestServiceConfiguration' -] +__all__ = ['AutoRestComplexTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/auto_rest_complex_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/auto_rest_complex_test_service.py index 3887687ac962..06e9d1c27b30 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/auto_rest_complex_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/auto_rest_complex_test_service.py @@ -54,8 +54,8 @@ def __init__( class AutoRestComplexTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestComplexTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestComplexTestServiceConfiguration :ivar basic_operations: BasicOperations operations :vartype basic_operations: .operations.BasicOperations @@ -73,17 +73,23 @@ class AutoRestComplexTestService(object): :vartype polymorphicrecursive: .operations.Polymorphicrecursive :ivar readonlyproperty: Readonlyproperty operations :vartype readonlyproperty: .operations.Readonlyproperty + + :param api_version: API ID. + :type api_version: str + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, api_version, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestComplexTestServiceConfiguration(api_version, base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.basic_operations = BasicOperations( self._client, self.config, self._serialize, self._deserialize) self.primitive = Primitive( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py index e375d28d5b3a..c059d47abde5 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py @@ -107,7 +107,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'ArrayWrapper') + body_content = self._serialize.body(complex_body, models.ArrayWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -197,7 +197,7 @@ def put_empty( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'ArrayWrapper') + body_content = self._serialize.body(complex_body, models.ArrayWrapper) # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py index f1cf4be957c2..8421c46c8bbf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py @@ -107,7 +107,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'Basic') + body_content = self._serialize.body(complex_body, models.Basic) # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py index c99f68238ac6..265c0905f8a2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py @@ -107,7 +107,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'DictionaryWrapper') + body_content = self._serialize.body(complex_body, models.DictionaryWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -197,7 +197,7 @@ def put_empty( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'DictionaryWrapper') + body_content = self._serialize.body(complex_body, models.DictionaryWrapper) # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py index 94062da6c3bf..273b3940cc52 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py @@ -109,7 +109,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'Siamese') + body_content = self._serialize.body(complex_body, models.Siamese) # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py index d2aadc47ad3a..37cf2c78fd52 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py @@ -158,7 +158,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'Fish') + body_content = self._serialize.body(complex_body, models.Fish) # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py index 3b3d75f90dfb..c9fe7cf53ad5 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py @@ -139,7 +139,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'Fish') + body_content = self._serialize.body(complex_body, models.Fish) # Construct and send request request = self._client.put(url, query_parameters) @@ -210,7 +210,7 @@ def put_valid_missing_required( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'Fish') + body_content = self._serialize.body(complex_body, models.Fish) # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py index de0386c4de16..855d8902557f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py @@ -106,7 +106,7 @@ def put_int( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'IntWrapper') + body_content = self._serialize.body(complex_body, models.IntWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -195,7 +195,7 @@ def put_long( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'LongWrapper') + body_content = self._serialize.body(complex_body, models.LongWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -284,7 +284,7 @@ def put_float( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'FloatWrapper') + body_content = self._serialize.body(complex_body, models.FloatWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -374,7 +374,7 @@ def put_double( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'DoubleWrapper') + body_content = self._serialize.body(complex_body, models.DoubleWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -463,7 +463,7 @@ def put_bool( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'BooleanWrapper') + body_content = self._serialize.body(complex_body, models.BooleanWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -552,7 +552,7 @@ def put_string( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'StringWrapper') + body_content = self._serialize.body(complex_body, models.StringWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -641,7 +641,7 @@ def put_date( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'DateWrapper') + body_content = self._serialize.body(complex_body, models.DateWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -731,7 +731,7 @@ def put_date_time( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'DatetimeWrapper') + body_content = self._serialize.body(complex_body, models.DatetimeWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -821,7 +821,7 @@ def put_date_time_rfc1123( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'Datetimerfc1123Wrapper') + body_content = self._serialize.body(complex_body, models.Datetimerfc1123Wrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -911,7 +911,7 @@ def put_duration( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'DurationWrapper') + body_content = self._serialize.body(complex_body, models.DurationWrapper) # Construct and send request request = self._client.put(url, query_parameters) @@ -1001,7 +1001,7 @@ def put_byte( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'ByteWrapper') + body_content = self._serialize.body(complex_body, models.ByteWrapper) # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py index fde563ffc3a2..3ad3012adf2b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py @@ -106,7 +106,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, 'ReadonlyObj') + body_content = self._serialize.body(complex_body, models.ReadonlyObj) # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/__init__.py index b7af2707b1e9..f8fdc22a6549 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_date_test_service import AutoRestDateTestService, AutoRestDateTestServiceConfiguration +from .auto_rest_date_test_service import AutoRestDateTestService from .version import VERSION -__all__ = [ - 'AutoRestDateTestService', - 'AutoRestDateTestServiceConfiguration' -] +__all__ = ['AutoRestDateTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/auto_rest_date_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/auto_rest_date_test_service.py index 0f74549ec39a..d589aef9c078 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/auto_rest_date_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/auto_rest_date_test_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestDateTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestDateTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestDateTestServiceConfiguration :ivar date_model: DateModel operations :vartype date_model: .operations.DateModel + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestDateTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.date_model = DateModel( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/__init__.py index 715d9b2347be..40d7df46c4ee 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_date_time_test_service import AutoRestDateTimeTestService, AutoRestDateTimeTestServiceConfiguration +from .auto_rest_date_time_test_service import AutoRestDateTimeTestService from .version import VERSION -__all__ = [ - 'AutoRestDateTimeTestService', - 'AutoRestDateTimeTestServiceConfiguration' -] +__all__ = ['AutoRestDateTimeTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/auto_rest_date_time_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/auto_rest_date_time_test_service.py index ccfa0103070c..63020ce19098 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/auto_rest_date_time_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/auto_rest_date_time_test_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestDateTimeTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestDateTimeTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestDateTimeTestServiceConfiguration :ivar datetime_model: DatetimeModel operations :vartype datetime_model: .operations.DatetimeModel + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestDateTimeTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.datetime_model = DatetimeModel( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/__init__.py index 6ce64523d992..85daa6afc250 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_rfc1123_date_time_test_service import AutoRestRFC1123DateTimeTestService, AutoRestRFC1123DateTimeTestServiceConfiguration +from .auto_rest_rfc1123_date_time_test_service import AutoRestRFC1123DateTimeTestService from .version import VERSION -__all__ = [ - 'AutoRestRFC1123DateTimeTestService', - 'AutoRestRFC1123DateTimeTestServiceConfiguration' -] +__all__ = ['AutoRestRFC1123DateTimeTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/auto_rest_rfc1123_date_time_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/auto_rest_rfc1123_date_time_test_service.py index 0863e02445f7..fb3ccf262d9a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/auto_rest_rfc1123_date_time_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/auto_rest_rfc1123_date_time_test_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestRFC1123DateTimeTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestRFC1123DateTimeTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestRFC1123DateTimeTestServiceConfiguration :ivar datetimerfc1123: Datetimerfc1123 operations :vartype datetimerfc1123: .operations.Datetimerfc1123 + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestRFC1123DateTimeTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.datetimerfc1123 = Datetimerfc1123( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/__init__.py index b835d08c52f1..81ebb3c0c24d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_swagger_ba_tdictionary_service import AutoRestSwaggerBATdictionaryService, AutoRestSwaggerBATdictionaryServiceConfiguration +from .auto_rest_swagger_ba_tdictionary_service import AutoRestSwaggerBATdictionaryService from .version import VERSION -__all__ = [ - 'AutoRestSwaggerBATdictionaryService', - 'AutoRestSwaggerBATdictionaryServiceConfiguration' -] +__all__ = ['AutoRestSwaggerBATdictionaryService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/auto_rest_swagger_ba_tdictionary_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/auto_rest_swagger_ba_tdictionary_service.py index 0347ffaeef4c..c8fd56f67c1f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/auto_rest_swagger_ba_tdictionary_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/auto_rest_swagger_ba_tdictionary_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestSwaggerBATdictionaryService(object): """Test Infrastructure for AutoRest Swagger BAT - :param config: Configuration for client. - :type config: AutoRestSwaggerBATdictionaryServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestSwaggerBATdictionaryServiceConfiguration :ivar dictionary: Dictionary operations :vartype dictionary: .operations.Dictionary + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestSwaggerBATdictionaryServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.dictionary = Dictionary( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/__init__.py index 2b089964f917..4ec26f57486d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_duration_test_service import AutoRestDurationTestService, AutoRestDurationTestServiceConfiguration +from .auto_rest_duration_test_service import AutoRestDurationTestService from .version import VERSION -__all__ = [ - 'AutoRestDurationTestService', - 'AutoRestDurationTestServiceConfiguration' -] +__all__ = ['AutoRestDurationTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py index 6b92034f3579..23ffff520466 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestDurationTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestDurationTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestDurationTestServiceConfiguration :ivar duration: Duration operations :vartype duration: .operations.Duration + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestDurationTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.duration = Duration( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/__init__.py index e50acad67ee8..51dcc09c8364 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_swagger_bat_file_service import AutoRestSwaggerBATFileService, AutoRestSwaggerBATFileServiceConfiguration +from .auto_rest_swagger_bat_file_service import AutoRestSwaggerBATFileService from .version import VERSION -__all__ = [ - 'AutoRestSwaggerBATFileService', - 'AutoRestSwaggerBATFileServiceConfiguration' -] +__all__ = ['AutoRestSwaggerBATFileService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/auto_rest_swagger_bat_file_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/auto_rest_swagger_bat_file_service.py index ed4b424e1eee..aa002c6d14bb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/auto_rest_swagger_bat_file_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/auto_rest_swagger_bat_file_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestSwaggerBATFileService(object): """Test Infrastructure for AutoRest Swagger BAT - :param config: Configuration for client. - :type config: AutoRestSwaggerBATFileServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestSwaggerBATFileServiceConfiguration :ivar files: Files operations :vartype files: .operations.Files + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestSwaggerBATFileServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.files = Files( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/__init__.py index 37291171869e..3460a7aa1b04 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_swagger_bat_form_data_service import AutoRestSwaggerBATFormDataService, AutoRestSwaggerBATFormDataServiceConfiguration +from .auto_rest_swagger_bat_form_data_service import AutoRestSwaggerBATFormDataService from .version import VERSION -__all__ = [ - 'AutoRestSwaggerBATFormDataService', - 'AutoRestSwaggerBATFormDataServiceConfiguration' -] +__all__ = ['AutoRestSwaggerBATFormDataService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/auto_rest_swagger_bat_form_data_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/auto_rest_swagger_bat_form_data_service.py index 96060d040eb6..5dab02ffeb01 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/auto_rest_swagger_bat_form_data_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/auto_rest_swagger_bat_form_data_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestSwaggerBATFormDataService(object): """Test Infrastructure for AutoRest Swagger BAT - :param config: Configuration for client. - :type config: AutoRestSwaggerBATFormDataServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestSwaggerBATFormDataServiceConfiguration :ivar formdata: Formdata operations :vartype formdata: .operations.Formdata + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestSwaggerBATFormDataServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.formdata = Formdata( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/__init__.py index 940d02de2bb4..ee85c655bdbb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_integer_test_service import AutoRestIntegerTestService, AutoRestIntegerTestServiceConfiguration +from .auto_rest_integer_test_service import AutoRestIntegerTestService from .version import VERSION -__all__ = [ - 'AutoRestIntegerTestService', - 'AutoRestIntegerTestServiceConfiguration' -] +__all__ = ['AutoRestIntegerTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/auto_rest_integer_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/auto_rest_integer_test_service.py index 3fa0acf42d06..cb2b63aeb46f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/auto_rest_integer_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/auto_rest_integer_test_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestIntegerTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestIntegerTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestIntegerTestServiceConfiguration :ivar int_model: IntModel operations :vartype int_model: .operations.IntModel + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestIntegerTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.int_model = IntModel( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/operations/int_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/operations/int_model.py index a2b06061ed5c..8474f7d5cdf3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/operations/int_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/operations/int_model.py @@ -477,7 +477,7 @@ def get_unix_time( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: long + :rtype: datetime :rtype: :class:`ClientRawResponse` if raw=true """ @@ -503,7 +503,7 @@ def get_unix_time( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('long', response) + deserialized = self._deserialize('unix-time', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -517,7 +517,7 @@ def put_unix_time_date( Put datetime encoded as Unix time :param int_body: - :type int_body: long + :type int_body: datetime :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -540,7 +540,7 @@ def put_unix_time_date( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(int_body, 'long') + body_content = self._serialize.body(int_body, 'unix-time') # Construct and send request request = self._client.put(url, query_parameters) @@ -564,7 +564,7 @@ def get_invalid_unix_time( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: long + :rtype: datetime :rtype: :class:`ClientRawResponse` if raw=true """ @@ -590,7 +590,7 @@ def get_invalid_unix_time( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('long', response) + deserialized = self._deserialize('unix-time', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -608,7 +608,7 @@ def get_null_unix_time( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: long + :rtype: datetime :rtype: :class:`ClientRawResponse` if raw=true """ @@ -634,7 +634,7 @@ def get_null_unix_time( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('long', response) + deserialized = self._deserialize('unix-time', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/__init__.py index 2de2f291c3a9..b43669b4296b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_number_test_service import AutoRestNumberTestService, AutoRestNumberTestServiceConfiguration +from .auto_rest_number_test_service import AutoRestNumberTestService from .version import VERSION -__all__ = [ - 'AutoRestNumberTestService', - 'AutoRestNumberTestServiceConfiguration' -] +__all__ = ['AutoRestNumberTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/auto_rest_number_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/auto_rest_number_test_service.py index ff0cbc28173b..cbc51e4caf41 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/auto_rest_number_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/auto_rest_number_test_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestNumberTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestNumberTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestNumberTestServiceConfiguration :ivar number: Number operations :vartype number: .operations.Number + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestNumberTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.number = Number( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/__init__.py index 6f40aa482a0e..e9981a167757 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_swagger_bat_service import AutoRestSwaggerBATService, AutoRestSwaggerBATServiceConfiguration +from .auto_rest_swagger_bat_service import AutoRestSwaggerBATService from .version import VERSION -__all__ = [ - 'AutoRestSwaggerBATService', - 'AutoRestSwaggerBATServiceConfiguration' -] +__all__ = ['AutoRestSwaggerBATService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/auto_rest_swagger_bat_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/auto_rest_swagger_bat_service.py index 8f31568d5079..d2aca590c6fa 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/auto_rest_swagger_bat_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/auto_rest_swagger_bat_service.py @@ -40,24 +40,28 @@ def __init__( class AutoRestSwaggerBATService(object): """Test Infrastructure for AutoRest Swagger BAT - :param config: Configuration for client. - :type config: AutoRestSwaggerBATServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestSwaggerBATServiceConfiguration :ivar string: String operations :vartype string: .operations.String :ivar enum: Enum operations :vartype enum: .operations.Enum + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestSwaggerBATServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.string = String( self._client, self.config, self._serialize, self._deserialize) self.enum = Enum( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/__init__.py index ba883e5e5ac4..55019b8878d2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient, AutoRestParameterizedHostTestClientConfiguration +from .auto_rest_parameterized_host_test_client import AutoRestParameterizedHostTestClient from .version import VERSION -__all__ = [ - 'AutoRestParameterizedHostTestClient', - 'AutoRestParameterizedHostTestClientConfiguration' -] +__all__ = ['AutoRestParameterizedHostTestClient'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py index 5839338b5a2d..bbed94ec1caf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py @@ -46,21 +46,27 @@ def __init__( class AutoRestParameterizedHostTestClient(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestParameterizedHostTestClientConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestParameterizedHostTestClientConfiguration :ivar paths: Paths operations :vartype paths: .operations.Paths + + :param host: A string value that is used as a global part of the + parameterized host + :type host: str + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, host, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestParameterizedHostTestClientConfiguration(host, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.paths = Paths( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/__init__.py index 6711cf5b14df..edfa86f28006 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_parameterized_custom_host_test_client import AutoRestParameterizedCustomHostTestClient, AutoRestParameterizedCustomHostTestClientConfiguration +from .auto_rest_parameterized_custom_host_test_client import AutoRestParameterizedCustomHostTestClient from .version import VERSION -__all__ = [ - 'AutoRestParameterizedCustomHostTestClient', - 'AutoRestParameterizedCustomHostTestClientConfiguration' -] +__all__ = ['AutoRestParameterizedCustomHostTestClient'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/auto_rest_parameterized_custom_host_test_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/auto_rest_parameterized_custom_host_test_client.py index 6a61d697f46e..3b659079f192 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/auto_rest_parameterized_custom_host_test_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/auto_rest_parameterized_custom_host_test_client.py @@ -53,21 +53,29 @@ def __init__( class AutoRestParameterizedCustomHostTestClient(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestParameterizedCustomHostTestClientConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestParameterizedCustomHostTestClientConfiguration :ivar paths: Paths operations :vartype paths: .operations.Paths + + :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'. + :type dns_suffix: str + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, subscription_id, dns_suffix, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestParameterizedCustomHostTestClientConfiguration(subscription_id, dns_suffix, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.paths = Paths( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/__init__.py index 6068e7d5e068..60f936ea909a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_swagger_bat_header_service import AutoRestSwaggerBATHeaderService, AutoRestSwaggerBATHeaderServiceConfiguration +from .auto_rest_swagger_bat_header_service import AutoRestSwaggerBATHeaderService from .version import VERSION -__all__ = [ - 'AutoRestSwaggerBATHeaderService', - 'AutoRestSwaggerBATHeaderServiceConfiguration' -] +__all__ = ['AutoRestSwaggerBATHeaderService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/auto_rest_swagger_bat_header_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/auto_rest_swagger_bat_header_service.py index 65e70d44935b..353542329d89 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/auto_rest_swagger_bat_header_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/auto_rest_swagger_bat_header_service.py @@ -39,21 +39,25 @@ def __init__( class AutoRestSwaggerBATHeaderService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestSwaggerBATHeaderServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestSwaggerBATHeaderServiceConfiguration :ivar header: Header operations :vartype header: .operations.Header + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestSwaggerBATHeaderServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.header = Header( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/__init__.py index 8e690ea9480f..539c0efb2a9a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_http_infrastructure_test_service import AutoRestHttpInfrastructureTestService, AutoRestHttpInfrastructureTestServiceConfiguration +from .auto_rest_http_infrastructure_test_service import AutoRestHttpInfrastructureTestService from .version import VERSION -__all__ = [ - 'AutoRestHttpInfrastructureTestService', - 'AutoRestHttpInfrastructureTestServiceConfiguration' -] +__all__ = ['AutoRestHttpInfrastructureTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/auto_rest_http_infrastructure_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/auto_rest_http_infrastructure_test_service.py index a70f0e4750f8..c7c9308ea102 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/auto_rest_http_infrastructure_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/auto_rest_http_infrastructure_test_service.py @@ -45,8 +45,8 @@ def __init__( class AutoRestHttpInfrastructureTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestHttpInfrastructureTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestHttpInfrastructureTestServiceConfiguration :ivar http_failure: HttpFailure operations :vartype http_failure: .operations.HttpFailure @@ -62,17 +62,21 @@ class AutoRestHttpInfrastructureTestService(object): :vartype http_retry: .operations.HttpRetry :ivar multiple_responses: MultipleResponses operations :vartype multiple_responses: .operations.MultipleResponses + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestHttpInfrastructureTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.http_failure = HttpFailure( self._client, self.config, self._serialize, self._deserialize) self.http_success = HttpSuccess( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/__init__.py index a81829bba4a6..f01b0f4d2710 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_resource_flattening_test_service import AutoRestResourceFlatteningTestService, AutoRestResourceFlatteningTestServiceConfiguration +from .auto_rest_resource_flattening_test_service import AutoRestResourceFlatteningTestService from .version import VERSION -__all__ = [ - 'AutoRestResourceFlatteningTestService', - 'AutoRestResourceFlatteningTestServiceConfiguration' -] +__all__ = ['AutoRestResourceFlatteningTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py index b0a90b0981ec..2c737ce3767d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py @@ -39,19 +39,23 @@ def __init__( class AutoRestResourceFlatteningTestService(object): """Resource Flattening for AutoRest - :param config: Configuration for client. - :type config: AutoRestResourceFlatteningTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestResourceFlatteningTestServiceConfiguration + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestResourceFlatteningTestServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config def put_array( self, resource_array=None, custom_headers={}, raw=False, **operation_config): @@ -267,7 +271,7 @@ def put_resource_collection( # Construct body if resource_complex_object is not None: - body_content = self._serialize.body(resource_complex_object, 'ResourceCollection') + body_content = self._serialize.body(resource_complex_object, models.ResourceCollection) else: body_content = None @@ -360,7 +364,7 @@ def put_simple_product( # Construct body if simple_body_product is not None: - body_content = self._serialize.body(simple_body_product, 'SimpleProduct') + body_content = self._serialize.body(simple_body_product, models.SimpleProduct) else: body_content = None @@ -429,7 +433,7 @@ def post_flattened_simple_product( # Construct body if simple_body_product is not None: - body_content = self._serialize.body(simple_body_product, 'SimpleProduct') + body_content = self._serialize.body(simple_body_product, models.SimpleProduct) else: body_content = None @@ -511,7 +515,7 @@ def put_simple_product_with_grouping( # Construct body if simple_body_product is not None: - body_content = self._serialize.body(simple_body_product, 'SimpleProduct') + body_content = self._serialize.body(simple_body_product, models.SimpleProduct) else: body_content = None diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/__init__.py index d7676b401a1e..eb1fb871fdd1 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_parameter_flattening import AutoRestParameterFlattening, AutoRestParameterFlatteningConfiguration +from .auto_rest_parameter_flattening import AutoRestParameterFlattening from .version import VERSION -__all__ = [ - 'AutoRestParameterFlattening', - 'AutoRestParameterFlatteningConfiguration' -] +__all__ = ['AutoRestParameterFlattening'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/auto_rest_parameter_flattening.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/auto_rest_parameter_flattening.py index de25b7d5f0a7..35cc30f5052d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/auto_rest_parameter_flattening.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/auto_rest_parameter_flattening.py @@ -39,21 +39,25 @@ def __init__( class AutoRestParameterFlattening(object): """Resource Flattening for AutoRest - :param config: Configuration for client. - :type config: AutoRestParameterFlatteningConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestParameterFlatteningConfiguration :ivar availability_sets: AvailabilitySets operations :vartype availability_sets: .operations.AvailabilitySets + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestParameterFlatteningConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.availability_sets = AvailabilitySets( self._client, self.config, self._serialize, self._deserialize) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py index ec69672916dc..5728b0ee3d15 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py @@ -72,7 +72,7 @@ def update( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(tags1, 'AvailabilitySetUpdateParameters') + body_content = self._serialize.body(tags1, models.AvailabilitySetUpdateParameters) # Construct and send request request = self._client.patch(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/__init__.py index 8ecae208fac4..22573b1921a8 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_report_service import AutoRestReportService, AutoRestReportServiceConfiguration +from .auto_rest_report_service import AutoRestReportService from .version import VERSION -__all__ = [ - 'AutoRestReportService', - 'AutoRestReportServiceConfiguration' -] +__all__ = ['AutoRestReportService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py index 333455a14a14..31aeda82eab3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py @@ -39,19 +39,23 @@ def __init__( class AutoRestReportService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestReportServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestReportServiceConfiguration + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestReportServiceConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config def get_report( self, custom_headers={}, raw=False, **operation_config): diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/__init__.py index 260d9c07a819..23a6ed29f55e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_required_optional_test_service import AutoRestRequiredOptionalTestService, AutoRestRequiredOptionalTestServiceConfiguration +from .auto_rest_required_optional_test_service import AutoRestRequiredOptionalTestService from .version import VERSION -__all__ = [ - 'AutoRestRequiredOptionalTestService', - 'AutoRestRequiredOptionalTestServiceConfiguration' -] +__all__ = ['AutoRestRequiredOptionalTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/auto_rest_required_optional_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/auto_rest_required_optional_test_service.py index 7dcce131d92a..d9549ba15ea8 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/auto_rest_required_optional_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/auto_rest_required_optional_test_service.py @@ -58,24 +58,34 @@ def __init__( class AutoRestRequiredOptionalTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestRequiredOptionalTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestRequiredOptionalTestServiceConfiguration :ivar implicit: Implicit operations :vartype implicit: .operations.Implicit :ivar explicit: Explicit operations :vartype explicit: .operations.Explicit + + :param required_global_path: number of items to skip + :type required_global_path: str + :param required_global_query: number of items to skip + :type required_global_query: str + :param optional_global_query: number of items to skip + :type optional_global_query: int + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, required_global_path, required_global_query, optional_global_query=None, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestRequiredOptionalTestServiceConfiguration(required_global_path, required_global_query, optional_global_query, base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.implicit = Implicit( self._client, self.config, self._serialize, self._deserialize) self.explicit = Explicit( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py index 4f56d1d617c0..f4f0239b0e48 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py @@ -156,7 +156,7 @@ def post_required_integer_property( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, 'IntWrapper') + body_content = self._serialize.body(body_parameter, models.IntWrapper) # Construct and send request request = self._client.post(url, query_parameters) @@ -205,7 +205,7 @@ def post_optional_integer_property( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, 'IntOptionalWrapper') + body_content = self._serialize.body(body_parameter, models.IntOptionalWrapper) else: body_content = None @@ -431,7 +431,7 @@ def post_required_string_property( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, 'StringWrapper') + body_content = self._serialize.body(body_parameter, models.StringWrapper) # Construct and send request request = self._client.post(url, query_parameters) @@ -480,7 +480,7 @@ def post_optional_string_property( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, 'StringOptionalWrapper') + body_content = self._serialize.body(body_parameter, models.StringOptionalWrapper) else: body_content = None @@ -613,7 +613,7 @@ def post_required_class_parameter( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, 'Product') + body_content = self._serialize.body(body_parameter, models.Product) # Construct and send request request = self._client.post(url, query_parameters) @@ -658,7 +658,7 @@ def post_optional_class_parameter( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, 'Product') + body_content = self._serialize.body(body_parameter, models.Product) else: body_content = None @@ -709,7 +709,7 @@ def post_required_class_property( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, 'ClassWrapper') + body_content = self._serialize.body(body_parameter, models.ClassWrapper) # Construct and send request request = self._client.post(url, query_parameters) @@ -759,7 +759,7 @@ def post_optional_class_property( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, 'ClassOptionalWrapper') + body_content = self._serialize.body(body_parameter, models.ClassOptionalWrapper) else: body_content = None @@ -900,7 +900,7 @@ def post_required_array_property( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, 'ArrayWrapper') + body_content = self._serialize.body(body_parameter, models.ArrayWrapper) # Construct and send request request = self._client.post(url, query_parameters) @@ -949,7 +949,7 @@ def post_optional_array_property( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, 'ArrayOptionalWrapper') + body_content = self._serialize.body(body_parameter, models.ArrayOptionalWrapper) else: body_content = None diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/__init__.py index fc6d1efe1f58..523c4f140178 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_url_test_service import AutoRestUrlTestService, AutoRestUrlTestServiceConfiguration +from .auto_rest_url_test_service import AutoRestUrlTestService from .version import VERSION -__all__ = [ - 'AutoRestUrlTestService', - 'AutoRestUrlTestServiceConfiguration' -] +__all__ = ['AutoRestUrlTestService'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/auto_rest_url_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/auto_rest_url_test_service.py index 34efde192fd6..0c6834405656 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/auto_rest_url_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/auto_rest_url_test_service.py @@ -55,8 +55,8 @@ def __init__( class AutoRestUrlTestService(object): """Test Infrastructure for AutoRest - :param config: Configuration for client. - :type config: AutoRestUrlTestServiceConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestUrlTestServiceConfiguration :ivar paths: Paths operations :vartype paths: .operations.Paths @@ -64,17 +64,26 @@ class AutoRestUrlTestService(object): :vartype queries: .operations.Queries :ivar path_items: PathItems operations :vartype path_items: .operations.PathItems + + :param global_string_path: A string value 'globalItemStringPath' that + appears in the path + :type global_string_path: str + :param global_string_query: should contain value null + :type global_string_query: str + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, global_string_path, global_string_query=None, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestUrlTestServiceConfiguration(global_string_path, global_string_query, base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.paths = Paths( self._client, self.config, self._serialize, self._deserialize) self.queries = Queries( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py index c419d607826a..3e6e638a031b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py @@ -1121,7 +1121,7 @@ def unix_time_url( Get the date 2016-04-13 encoded value as '1460505600' (Unix time) :param unix_time_url_path: Unix time encoded value - :type unix_time_url_path: long + :type unix_time_url_path: datetime :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1134,7 +1134,7 @@ def unix_time_url( # Construct URL url = '/paths/int/1460505600/{unixTimeUrlPath}' path_format_arguments = { - 'unixTimeUrlPath': self._serialize.url("unix_time_url_path", unix_time_url_path, 'long') + 'unixTimeUrlPath': self._serialize.url("unix_time_url_path", unix_time_url_path, 'unix-time') } url = self._client.format_url(url, **path_format_arguments) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/__init__.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/__init__.py index 202f03f0f743..885383be0a47 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/__init__.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/__init__.py @@ -9,13 +9,10 @@ # regenerated. # -------------------------------------------------------------------------- -from .auto_rest_validation_test import AutoRestValidationTest, AutoRestValidationTestConfiguration +from .auto_rest_validation_test import AutoRestValidationTest from .version import VERSION -__all__ = [ - 'AutoRestValidationTest', - 'AutoRestValidationTestConfiguration' -] +__all__ = ['AutoRestValidationTest'] __version__ = VERSION diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py index f9a6b88ede46..9d63617ddbbf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py @@ -55,19 +55,27 @@ def __init__( class AutoRestValidationTest(object): """Test Infrastructure for AutoRest. No server backend exists for these tests. - :param config: Configuration for client. - :type config: AutoRestValidationTestConfiguration + :ivar config: Configuration for client. + :vartype config: AutoRestValidationTestConfiguration + + :param subscription_id: Subscription ID. + :type subscription_id: str + :param api_version: Required string following pattern \\d{2}-\\d{2}-\\d{4} + :type api_version: str + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, subscription_id, api_version, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = AutoRestValidationTestConfiguration(subscription_id, api_version, base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config def validation_of_method_parameters( self, resource_group_name, id, custom_headers={}, raw=False, **operation_config): @@ -170,7 +178,7 @@ def validation_of_body( # Construct body if body is not None: - body_content = self._serialize.body(body, 'Product') + body_content = self._serialize.body(body, models.Product) else: body_content = None @@ -272,7 +280,7 @@ def post_with_constant_in_body( # Construct body if body is not None: - body_content = self._serialize.body(body, 'Product') + body_content = self._serialize.body(body, models.Product) else: body_content = None diff --git a/Samples/azure-storage/Azure.Python/storagemanagementclient/__init__.py b/Samples/azure-storage/Azure.Python/storagemanagementclient/__init__.py index 8da05fb0ca8e..4ef2ad555990 100644 --- a/Samples/azure-storage/Azure.Python/storagemanagementclient/__init__.py +++ b/Samples/azure-storage/Azure.Python/storagemanagementclient/__init__.py @@ -2,13 +2,10 @@ # -------------------------------------------------------------------------- # -------------------------------------------------------------------------- -from .storage_management_client import StorageManagementClient, StorageManagementClientConfiguration +from .storage_management_client import StorageManagementClient from .version import VERSION -__all__ = [ - 'StorageManagementClient', - 'StorageManagementClientConfiguration' -] +__all__ = ['StorageManagementClient'] __version__ = VERSION diff --git a/Samples/azure-storage/Azure.Python/storagemanagementclient/operations/storage_accounts_operations.py b/Samples/azure-storage/Azure.Python/storagemanagementclient/operations/storage_accounts_operations.py index ef19c00fbeea..e8412716ef69 100644 --- a/Samples/azure-storage/Azure.Python/storagemanagementclient/operations/storage_accounts_operations.py +++ b/Samples/azure-storage/Azure.Python/storagemanagementclient/operations/storage_accounts_operations.py @@ -71,7 +71,7 @@ def check_name_availability( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') + body_content = self._serialize.body(account_name, models.StorageAccountCheckNameAvailabilityParameters) # Construct and send request request = self._client.post(url, query_parameters) @@ -148,7 +148,7 @@ def create( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') + body_content = self._serialize.body(parameters, models.StorageAccountCreateParameters) # Construct and send request def long_running_send(): @@ -380,7 +380,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + body_content = self._serialize.body(parameters, models.StorageAccountUpdateParameters) # Construct and send request request = self._client.patch(url, query_parameters) @@ -650,7 +650,7 @@ def regenerate_key( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') + body_content = self._serialize.body(regenerate_key, models.StorageAccountRegenerateKeyParameters) # Construct and send request request = self._client.post(url, query_parameters) diff --git a/Samples/azure-storage/Azure.Python/storagemanagementclient/storage_management_client.py b/Samples/azure-storage/Azure.Python/storagemanagementclient/storage_management_client.py index 00031c87fca7..8c665e4cf9c4 100644 --- a/Samples/azure-storage/Azure.Python/storagemanagementclient/storage_management_client.py +++ b/Samples/azure-storage/Azure.Python/storagemanagementclient/storage_management_client.py @@ -71,24 +71,47 @@ def __init__( class StorageManagementClient(object): """The Storage Management Client. - :param config: Configuration for client. - :type config: StorageManagementClientConfiguration + :ivar config: Configuration for client. + :vartype config: StorageManagementClientConfiguration :ivar storage_accounts: StorageAccounts operations :vartype storage_accounts: .operations.StorageAccountsOperations :ivar usage: Usage operations :vartype usage: .operations.UsageOperations + + :param credentials: Gets Azure subscription credentials. + :type credentials: :mod:`A msrestazure Credentials + object` + :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 api_version: Client Api Version. + :type api_version: str + :param accept_language: Gets or sets the preferred language for the + response. + :type accept_language: str + :param long_running_operation_retry_timeout: Gets or sets the retry + timeout in seconds for Long Running Operations. Default value is 30. + :type long_running_operation_retry_timeout: int + :param generate_client_request_id: When set to true a unique + x-ms-client-request-id value is generated and included in each request. + Default is true. + :type generate_client_request_id: bool + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, credentials, subscription_id, api_version='2015-06-15', accept_language='en-US', long_running_operation_retry_timeout=30, generate_client_request_id=True, base_url=None, filepath=None): - self._client = ServiceClient(config.credentials, config) + self.config = StorageManagementClientConfiguration(credentials, subscription_id, api_version, accept_language, long_running_operation_retry_timeout, generate_client_request_id, base_url, filepath) + self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config self.storage_accounts = StorageAccountsOperations( self._client, self.config, self._serialize, self._deserialize) self.usage = UsageOperations( diff --git a/Samples/petstore/Python/swaggerpetstore/__init__.py b/Samples/petstore/Python/swaggerpetstore/__init__.py index 0caab4f5c7c7..06086d20d52d 100644 --- a/Samples/petstore/Python/swaggerpetstore/__init__.py +++ b/Samples/petstore/Python/swaggerpetstore/__init__.py @@ -2,13 +2,10 @@ # -------------------------------------------------------------------------- # -------------------------------------------------------------------------- -from .swagger_petstore import SwaggerPetstore, SwaggerPetstoreConfiguration +from .swagger_petstore import SwaggerPetstore from .version import VERSION -__all__ = [ - 'SwaggerPetstore', - 'SwaggerPetstoreConfiguration' -] +__all__ = ['SwaggerPetstore'] __version__ = VERSION diff --git a/Samples/petstore/Python/swaggerpetstore/swagger_petstore.py b/Samples/petstore/Python/swaggerpetstore/swagger_petstore.py index 461a21d5e699..ebc0bb5e009e 100644 --- a/Samples/petstore/Python/swaggerpetstore/swagger_petstore.py +++ b/Samples/petstore/Python/swaggerpetstore/swagger_petstore.py @@ -33,19 +33,23 @@ def __init__( class SwaggerPetstore(object): """This is a sample server Petstore server. You can find out more about Swagger at <a href="http://swagger.io">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key "special-key" to test the authorization filters - :param config: Configuration for client. - :type config: SwaggerPetstoreConfiguration + :ivar config: Configuration for client. + :vartype config: SwaggerPetstoreConfiguration + + :param str base_url: Service URL + :param str filepath: Existing config """ - def __init__(self, config): + def __init__( + self, base_url=None, filepath=None): - self._client = ServiceClient(None, config) + self.config = SwaggerPetstoreConfiguration(base_url, filepath) + self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer() self._deserialize = Deserializer(client_models) - self.config = config def add_pet_using_byte_array( self, body=None, custom_headers={}, raw=False, **operation_config): @@ -124,7 +128,7 @@ def add_pet( # Construct body if body is not None: - body_content = self._serialize.body(body, 'Pet') + body_content = self._serialize.body(body, models.Pet) else: body_content = None @@ -170,7 +174,7 @@ def update_pet( # Construct body if body is not None: - body_content = self._serialize.body(body, 'Pet') + body_content = self._serialize.body(body, models.Pet) else: body_content = None @@ -619,7 +623,7 @@ def place_order( # Construct body if body is not None: - body_content = self._serialize.body(body, 'Order') + body_content = self._serialize.body(body, models.Order) else: body_content = None @@ -770,7 +774,7 @@ def create_user( # Construct body if body is not None: - body_content = self._serialize.body(body, 'User') + body_content = self._serialize.body(body, models.User) else: body_content = None @@ -1055,7 +1059,7 @@ def update_user( # Construct body if body is not None: - body_content = self._serialize.body(body, 'User') + body_content = self._serialize.body(body, models.User) else: body_content = None From 00ff9b36010052cf11354ea6ecf5e9302e7ad86a Mon Sep 17 00:00:00 2001 From: annatisch Date: Tue, 10 May 2016 10:20:47 -0700 Subject: [PATCH 07/22] tox cleanups --- .../Python/msrest/msrest/serialization.py | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/ClientRuntimes/Python/msrest/msrest/serialization.py b/ClientRuntimes/Python/msrest/msrest/serialization.py index f1bd12f91c93..a39ef1679b69 100644 --- a/ClientRuntimes/Python/msrest/msrest/serialization.py +++ b/ClientRuntimes/Python/msrest/msrest/serialization.py @@ -143,18 +143,29 @@ def _classify(cls, response, objects): def _convert_to_datatype(params, localtype): """Convert a dict-like object to the given datatype """ - return _recursive_convert_to_datatype(params, localtype.__name__, importlib.import_module('..', localtype.__module__)) + return _recursive_convert_to_datatype( + params, + localtype.__name__, + importlib.import_module('..', localtype.__module__)) def _recursive_convert_to_datatype(params, str_localtype, models_module): """Convert a dict-like object to the given datatype """ if isinstance(params, list): - return [_recursive_convert_to_datatype(data, str_localtype[1:-1], models_module) for data in params] - localtype = getattr(models_module, str_localtype) if hasattr(models_module, str_localtype) else None + return [_recursive_convert_to_datatype( + data, + str_localtype[1:-1], + models_module) for data in params] + localtype = getattr(models_module, str_localtype, None) if not localtype: return params - result = {key: _recursive_convert_to_datatype(params[key], localtype._attribute_map[key]['type'], models_module) for key in params} + result = { + key: _recursive_convert_to_datatype( + params[key], + localtype._attribute_map[key]['type'], + models_module) for key in params + } return localtype(**result) @@ -579,7 +590,8 @@ def serialize_rfc(attr, **kwargs): """ try: if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError("RFC1123 object must be valid Datetime object.") @@ -602,7 +614,8 @@ def serialize_iso(attr, **kwargs): try: try: if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() except AttributeError: raise TypeError( @@ -631,9 +644,10 @@ def serialize_unix(attr, **kwargs): if isinstance(attr, int): return attr try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) + if not attr.tzinfo: + _LOGGER.warning( + "Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) except AttributeError: raise TypeError("Unix time object must be valid Datetime object.") @@ -1088,10 +1102,9 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ try: - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise_with_traceback(DeserializationError, msg, err) else: return date_obj - From 51948d78ef57c069e6b02897686d6955a69c9cdc Mon Sep 17 00:00:00 2001 From: annatisch Date: Tue, 10 May 2016 14:46:28 -0700 Subject: [PATCH 08/22] Refactored dict serialization --- .../AzureServiceClientTemplate.cshtml | 2 +- .../Templates/ServiceClientTemplate.cshtml | 2 +- .../Python/msrest/msrest/serialization.py | 86 +++++++++---------- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml index 383db9e00700..713d36e13242 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzureServiceClientTemplate.cshtml @@ -132,7 +132,7 @@ else { @:client_models = {} } - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @EmptyLine @foreach (var methodGroup in Model.MethodGroupModels) diff --git a/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml b/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml index e6ba317b1e19..5a93943f28a5 100644 --- a/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml +++ b/AutoRest/Generators/Python/Python/Templates/ServiceClientTemplate.cshtml @@ -125,7 +125,7 @@ else { @:client_models = {} } - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @EmptyLine @foreach (var methodGroup in Model.MethodGroupModels) diff --git a/ClientRuntimes/Python/msrest/msrest/serialization.py b/ClientRuntimes/Python/msrest/msrest/serialization.py index a39ef1679b69..c207aaa063f0 100644 --- a/ClientRuntimes/Python/msrest/msrest/serialization.py +++ b/ClientRuntimes/Python/msrest/msrest/serialization.py @@ -29,7 +29,6 @@ import datetime import decimal from enum import Enum -import importlib import json import logging import re @@ -95,7 +94,7 @@ def __init__(self, *args, **kwargs): def __eq__(self, other): """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ + return self.__class__.__dict__ == other.__class__.__dict__ return False def __ne__(self, other): @@ -140,33 +139,37 @@ def _classify(cls, response, objects): raise TypeError("Object cannot be classified futher.") -def _convert_to_datatype(params, localtype): - """Convert a dict-like object to the given datatype - """ - return _recursive_convert_to_datatype( - params, - localtype.__name__, - importlib.import_module('..', localtype.__module__)) - - -def _recursive_convert_to_datatype(params, str_localtype, models_module): - """Convert a dict-like object to the given datatype - """ - if isinstance(params, list): - return [_recursive_convert_to_datatype( - data, - str_localtype[1:-1], - models_module) for data in params] - localtype = getattr(models_module, str_localtype, None) - if not localtype: - return params - result = { - key: _recursive_convert_to_datatype( - params[key], - localtype._attribute_map[key]['type'], - models_module) for key in params - } - return localtype(**result) +def _convert_to_datatype(data, data_type, localtypes): + if data is None: + return data + data_obj = localtypes.get(data_type.strip('{[]}')) + if data_obj: + if data_type.startswith('['): + data = [ + _convert_to_datatype( + param, data_type[1:-1], localtypes) for param in data + ] + elif data_type.startswith('{'): + data = { + key: _convert_to_datatype( + data[key], data_type[1:-1], localtypes) for key in data + } + elif not isinstance(data, data_obj): + result = { + key: _convert_to_datatype( + data[key], + data_obj._attribute_map[key]['type'], + localtypes) for key in data + } + data = data_obj(**result) + else: + try: + for attr, map in data._attribute_map.items(): + setattr(data, attr, _convert_to_datatype( + getattr(data, attr), map['type'], localtypes)) + except AttributeError: + pass + return data class Serializer(object): @@ -192,7 +195,7 @@ class Serializer(object): } flattten = re.compile(r"(? 9999 or utc.tm_year < 1: raise OverflowError("Hit max or min date") @@ -631,6 +628,9 @@ def serialize_iso(attr, **kwargs): except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." raise_with_traceback(SerializationError, msg, err) + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise_with_traceback(TypeError, msg, err) @staticmethod def serialize_unix(attr, **kwargs): From 05f68a6d072d05a20071f91fddb3b5938325cf36 Mon Sep 17 00:00:00 2001 From: annatisch Date: Tue, 10 May 2016 14:46:56 -0700 Subject: [PATCH 09/22] Test dict serialization --- .../AcceptanceTests/complex_tests.py | 22 +++++++-------- .../AcceptanceTests/model_flattening_tests.py | 28 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py index 2c1e91dd4e75..88d8e9ee7db3 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py @@ -101,7 +101,7 @@ def test_complex(self): self.assertEqual(2, intResult.field2) # PUT primitive/integer - intRequest = IntWrapper(field1=-1, field2=2) + intRequest = {'field1':-1, 'field2':2} client.primitive.put_int(intRequest) # GET primitive/long @@ -110,7 +110,7 @@ def test_complex(self): self.assertEqual(-999511627788, longResult.field2) # PUT primitive/long - longRequest = LongWrapper(field1=1099511627775, field2=-999511627788) + longRequest = {'field1':1099511627775, 'field2':-999511627788} client.primitive.put_long(longRequest) # GET primitive/float @@ -128,8 +128,8 @@ def test_complex(self): self.assertEqual(-5e-57, doubleResult.field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose) # PUT primitive/double - doubleRequest = DoubleWrapper(field1=3e-100) - doubleRequest.field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose = -5e-57 + doubleRequest = {'field1':3e-100} + doubleRequest['field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose'] = -5e-57 client.primitive.put_double(doubleRequest); # GET primitive/bool @@ -269,14 +269,14 @@ def test_complex(self): self.assertEqual("Tomato", inheritanceResult.hates[1].name) # PUT inheritance/valid - request = Siamese( - id=2, - name="Siameeee", - color="green", - breed="persian", - hates=[Dog(id=1, name="Potato", food="tomato"), + request = { + 'id': 2, + 'name': "Siameeee", + 'color': "green", + 'breed': "persian", + 'hates': [Dog(id=1, name="Potato", food="tomato"), Dog(id=-1, name="Tomato", food="french fries")] - ) + } client.inheritance.put_valid(request) """ diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/model_flattening_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/model_flattening_tests.py index bb79352d8d75..7a80a4f152e8 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/model_flattening_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/model_flattening_tests.py @@ -84,11 +84,11 @@ def test_flattening_array(self): self.assertEqual("Resource3", result[2].name) resourceArray = [ - FlattenedProduct( - location = "West US", - tags = {"tag1":"value1", "tag2":"value3"}), - FlattenedProduct( - location = "Building 44")] + { + 'location': "West US", + 'tags': {"tag1":"value1", "tag2":"value3"}}, + { + 'location': "Building 44"}] self.client.put_array(resourceArray) @@ -117,15 +117,15 @@ def test_flattening_dictionary(self): self.assertEqual("Resource3", resultDictionary["Product3"].name) resourceDictionary = { - "Resource1": FlattenedProduct( - location = "West US", - tags = {"tag1":"value1", "tag2":"value3"}, - pname = "Product1", - flattened_product_type = "Flat"), - "Resource2": FlattenedProduct( - location = "Building 44", - pname = "Product2", - flattened_product_type = "Flat")} + "Resource1": { + 'location': "West US", + 'tags': {"tag1":"value1", "tag2":"value3"}, + 'pname': "Product1", + 'flattened_product_type': "Flat"}, + "Resource2": { + 'location': "Building 44", + 'pname': "Product2", + 'flattened_product_type': "Flat"}} self.client.put_dictionary(resourceDictionary) From 88438dfb11b631bdea5bf49ad78eac2d68da1694 Mon Sep 17 00:00:00 2001 From: annatisch Date: Tue, 10 May 2016 14:47:58 -0700 Subject: [PATCH 10/22] Regenerated tests --- .../auto_rest_duration_test_service.py | 2 +- ...to_rest_parameter_grouping_test_service.py | 2 +- .../auto_rest_report_service_for_azure.py | 2 +- ...o_rest_resource_flattening_test_service.py | 4 +- ...st_azure_special_parameters_test_client.py | 2 +- ...uto_rest_parameterized_host_test_client.py | 2 +- .../auto_rest_head_test_service.py | 2 +- .../auto_rest_head_exception_test_service.py | 2 +- ...est_long_running_operation_test_service.py | 2 +- .../lr_os_custom_header_operations.py | 8 ++-- .../operations/lr_os_operations.py | 46 +++++++++---------- .../operations/lro_retrys_operations.py | 8 ++-- .../operations/lrosa_ds_operations.py | 36 +++++++-------- .../auto_rest_paging_test_service.py | 2 +- .../operations/storage_accounts_operations.py | 8 ++-- .../storage_management_client.py | 2 +- .../microsoft_azure_test_url.py | 2 +- .../AutoRest.Generator.Azure.Python.csproj | 4 ++ .../auto_rest_swagger_bat_array_service.py | 2 +- .../auto_rest_bool_test_service.py | 2 +- .../auto_rest_swagger_bat_byte_service.py | 2 +- .../auto_rest_complex_test_service.py | 2 +- .../operations/array.py | 4 +- .../operations/basic_operations.py | 2 +- .../operations/dictionary.py | 4 +- .../operations/inheritance.py | 2 +- .../operations/polymorphicrecursive.py | 2 +- .../operations/polymorphism.py | 4 +- .../operations/primitive.py | 22 ++++----- .../operations/readonlyproperty.py | 2 +- .../auto_rest_date_test_service.py | 2 +- .../auto_rest_date_time_test_service.py | 2 +- ...uto_rest_rfc1123_date_time_test_service.py | 2 +- ...uto_rest_swagger_ba_tdictionary_service.py | 2 +- .../auto_rest_duration_test_service.py | 2 +- .../auto_rest_swagger_bat_file_service.py | 2 +- ...auto_rest_swagger_bat_form_data_service.py | 2 +- .../auto_rest_integer_test_service.py | 2 +- .../auto_rest_number_test_service.py | 2 +- .../auto_rest_swagger_bat_service.py | 2 +- ...uto_rest_parameterized_host_test_client.py | 2 +- ...t_parameterized_custom_host_test_client.py | 2 +- .../auto_rest_swagger_bat_header_service.py | 2 +- ...o_rest_http_infrastructure_test_service.py | 2 +- ...o_rest_resource_flattening_test_service.py | 10 ++-- .../auto_rest_parameter_flattening.py | 2 +- .../operations/availability_sets.py | 2 +- .../auto_rest_report_service.py | 2 +- ...uto_rest_required_optional_test_service.py | 2 +- .../operations/explicit.py | 20 ++++---- .../auto_rest_url_test_service.py | 2 +- .../auto_rest_validation_test.py | 6 +-- .../operations/storage_accounts_operations.py | 8 ++-- .../storage_management_client.py | 2 +- .../swaggerpetstore/swagger_petstore.py | 12 ++--- 55 files changed, 143 insertions(+), 139 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py index 532c33c57375..c0d65d8ae794 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py @@ -93,7 +93,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.duration = DurationOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/auto_rest_parameter_grouping_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/auto_rest_parameter_grouping_test_service.py index 15004842908e..6e0264658e5e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/auto_rest_parameter_grouping_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/auto_rest_parameter_grouping_test_service.py @@ -93,7 +93,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.parameter_grouping = ParameterGroupingOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py index 624bcd552166..948ebd96776d 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py @@ -91,7 +91,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py index aab82f8862e4..872a69a82131 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py @@ -91,7 +91,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -329,7 +329,7 @@ def put_resource_collection( # Construct body if resource_complex_object is not None: - body_content = self._serialize.body(resource_complex_object, models.ResourceCollection) + body_content = self._serialize.body(resource_complex_object, 'ResourceCollection') else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/auto_rest_azure_special_parameters_test_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/auto_rest_azure_special_parameters_test_client.py index 27217a362fa9..1c7d3213c701 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/auto_rest_azure_special_parameters_test_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/auto_rest_azure_special_parameters_test_client.py @@ -134,7 +134,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.xms_client_request_id = XMsClientRequestIdOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py index f6902e55c686..5c9a07ff0f55 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py @@ -101,7 +101,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.paths = PathsOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/auto_rest_head_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/auto_rest_head_test_service.py index 786fdce1b810..6d2a167e2356 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/auto_rest_head_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/auto_rest_head_test_service.py @@ -92,7 +92,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.http_success = HttpSuccessOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/auto_rest_head_exception_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/auto_rest_head_exception_test_service.py index 0a040dc195f2..833ddcb297cd 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/auto_rest_head_exception_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/auto_rest_head_exception_test_service.py @@ -92,7 +92,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.head_exception = HeadExceptionOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/auto_rest_long_running_operation_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/auto_rest_long_running_operation_test_service.py index 10be2f337715..68a1caef5b1a 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/auto_rest_long_running_operation_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/auto_rest_long_running_operation_test_service.py @@ -102,7 +102,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.lr_os = LROsOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py index 521b8b7e132e..96ade6d8e3ad 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py @@ -74,7 +74,7 @@ def put_async_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -168,7 +168,7 @@ def put201_creating_succeeded200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -256,7 +256,7 @@ def post202_retry200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -339,7 +339,7 @@ def post_async_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py index 743e4acfeda1..4a078a8a86f8 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py @@ -71,7 +71,7 @@ def put200_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -156,7 +156,7 @@ def put200_succeeded_no_state( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -241,7 +241,7 @@ def put202_retry200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -327,7 +327,7 @@ def put201_creating_succeeded200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -415,7 +415,7 @@ def put200_updating_succeeded204( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -501,7 +501,7 @@ def put201_creating_failed200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -589,7 +589,7 @@ def put200_acceptedcanceled200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -674,7 +674,7 @@ def put_no_header_in_retry( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -765,7 +765,7 @@ def put_async_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -858,7 +858,7 @@ def put_async_no_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -950,7 +950,7 @@ def put_async_retry_failed( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1043,7 +1043,7 @@ def put_async_no_retrycanceled( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1134,7 +1134,7 @@ def put_async_no_header_in_retry( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1221,7 +1221,7 @@ def put_non_resource( # Construct body if sku is not None: - body_content = self._serialize.body(sku, models.Sku) + body_content = self._serialize.body(sku, 'Sku') else: body_content = None @@ -1303,7 +1303,7 @@ def put_async_non_resource( # Construct body if sku is not None: - body_content = self._serialize.body(sku, models.Sku) + body_content = self._serialize.body(sku, 'Sku') else: body_content = None @@ -1386,7 +1386,7 @@ def put_sub_resource( # Construct body if product is not None: - body_content = self._serialize.body(product, models.SubProduct) + body_content = self._serialize.body(product, 'SubProduct') else: body_content = None @@ -1469,7 +1469,7 @@ def put_async_sub_resource( # Construct body if product is not None: - body_content = self._serialize.body(product, models.SubProduct) + body_content = self._serialize.body(product, 'SubProduct') else: body_content = None @@ -2549,7 +2549,7 @@ def post202_retry200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -2631,7 +2631,7 @@ def post202_no_retry204( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -2723,7 +2723,7 @@ def post_async_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -2816,7 +2816,7 @@ def post_async_no_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -2908,7 +2908,7 @@ def post_async_retry_failed( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -2991,7 +2991,7 @@ def post_async_retrycanceled( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py index 899a55b89635..786c3c3bf6d7 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py @@ -73,7 +73,7 @@ def put201_creating_succeeded200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -161,7 +161,7 @@ def put_async_relative_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -483,7 +483,7 @@ def post202_retry200( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -565,7 +565,7 @@ def post_async_relative_retry_succeeded( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py index d2de0cff4bd8..a211b6975e70 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py @@ -70,7 +70,7 @@ def put_non_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -156,7 +156,7 @@ def put_non_retry201_creating400( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -242,7 +242,7 @@ def put_non_retry201_creating400_invalid_json( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -329,7 +329,7 @@ def put_async_relative_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -629,7 +629,7 @@ def post_non_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -708,7 +708,7 @@ def post202_non_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -789,7 +789,7 @@ def post_async_relative_retry400( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -871,7 +871,7 @@ def put_error201_no_provisioning_state_payload( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -959,7 +959,7 @@ def put_async_relative_retry_no_status( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1052,7 +1052,7 @@ def put_async_relative_retry_no_status_payload( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1280,7 +1280,7 @@ def post202_no_location( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1362,7 +1362,7 @@ def post_async_relative_retry_no_payload( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1444,7 +1444,7 @@ def put200_invalid_json( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1529,7 +1529,7 @@ def put_async_relative_retry_invalid_header( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1622,7 +1622,7 @@ def put_async_relative_retry_invalid_json_polling( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -1927,7 +1927,7 @@ def post202_retry_invalid_header( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -2008,7 +2008,7 @@ def post_async_relative_retry_invalid_header( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None @@ -2091,7 +2091,7 @@ def post_async_relative_retry_invalid_json_polling( # Construct body if product is not None: - body_content = self._serialize.body(product, models.Product) + body_content = self._serialize.body(product, 'Product') else: body_content = None diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/auto_rest_paging_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/auto_rest_paging_test_service.py index b1bb993344a4..bf82da336e98 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/auto_rest_paging_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/auto_rest_paging_test_service.py @@ -93,7 +93,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.paging = PagingOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py index 4c6883792aae..2250ab10c146 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py @@ -78,7 +78,7 @@ def check_name_availability( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(account_name, models.StorageAccountCheckNameAvailabilityParameters) + body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') # Construct and send request request = self._client.post(url, query_parameters) @@ -155,7 +155,7 @@ def create( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, models.StorageAccountCreateParameters) + body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') # Construct and send request def long_running_send(): @@ -386,7 +386,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, models.StorageAccountUpdateParameters) + body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') # Construct and send request request = self._client.patch(url, query_parameters) @@ -656,7 +656,7 @@ def regenerate_key( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(regenerate_key, models.StorageAccountRegenerateKeyParameters) + body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') # Construct and send request request = self._client.post(url, query_parameters) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/storage_management_client.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/storage_management_client.py index 68f581fd8166..384c65cdaab4 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/storage_management_client.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/storage_management_client.py @@ -116,7 +116,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.storage_accounts = StorageAccountsOperations( diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py index 7283782c9388..7a5752c26569 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/microsoft_azure_test_url.py @@ -109,7 +109,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.group = GroupOperations( diff --git a/AutoRest/Generators/Python/Azure.Python/AutoRest.Generator.Azure.Python.csproj b/AutoRest/Generators/Python/Azure.Python/AutoRest.Generator.Azure.Python.csproj index 913e75195ac1..6ebaa9d83e79 100644 --- a/AutoRest/Generators/Python/Azure.Python/AutoRest.Generator.Azure.Python.csproj +++ b/AutoRest/Generators/Python/Azure.Python/AutoRest.Generator.Azure.Python.csproj @@ -20,6 +20,10 @@ 4 + + False + ..\..\..\..\..\..\..\CxCache\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll + diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/auto_rest_swagger_bat_array_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/auto_rest_swagger_bat_array_service.py index 5708ff6c6721..75d5ea27f0cf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/auto_rest_swagger_bat_array_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/auto_rest_swagger_bat_array_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.array = Array( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/auto_rest_bool_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/auto_rest_bool_test_service.py index 362fed213666..8cf4e5fffbd3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/auto_rest_bool_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/auto_rest_bool_test_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.bool_model = BoolModel( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/auto_rest_swagger_bat_byte_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/auto_rest_swagger_bat_byte_service.py index e95752ae8ff2..5da86b5b9161 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/auto_rest_swagger_bat_byte_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/auto_rest_swagger_bat_byte_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.byte = Byte( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/auto_rest_complex_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/auto_rest_complex_test_service.py index 06e9d1c27b30..05a5944dc05d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/auto_rest_complex_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/auto_rest_complex_test_service.py @@ -87,7 +87,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.basic_operations = BasicOperations( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py index c059d47abde5..e375d28d5b3a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py @@ -107,7 +107,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.ArrayWrapper) + body_content = self._serialize.body(complex_body, 'ArrayWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -197,7 +197,7 @@ def put_empty( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.ArrayWrapper) + body_content = self._serialize.body(complex_body, 'ArrayWrapper') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py index 8421c46c8bbf..f1cf4be957c2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py @@ -107,7 +107,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.Basic) + body_content = self._serialize.body(complex_body, 'Basic') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py index 265c0905f8a2..c99f68238ac6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py @@ -107,7 +107,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.DictionaryWrapper) + body_content = self._serialize.body(complex_body, 'DictionaryWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -197,7 +197,7 @@ def put_empty( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.DictionaryWrapper) + body_content = self._serialize.body(complex_body, 'DictionaryWrapper') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py index 273b3940cc52..94062da6c3bf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py @@ -109,7 +109,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.Siamese) + body_content = self._serialize.body(complex_body, 'Siamese') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py index 37cf2c78fd52..d2aadc47ad3a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py @@ -158,7 +158,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.Fish) + body_content = self._serialize.body(complex_body, 'Fish') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py index c9fe7cf53ad5..3b3d75f90dfb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py @@ -139,7 +139,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.Fish) + body_content = self._serialize.body(complex_body, 'Fish') # Construct and send request request = self._client.put(url, query_parameters) @@ -210,7 +210,7 @@ def put_valid_missing_required( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.Fish) + body_content = self._serialize.body(complex_body, 'Fish') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py index 855d8902557f..de0386c4de16 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py @@ -106,7 +106,7 @@ def put_int( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.IntWrapper) + body_content = self._serialize.body(complex_body, 'IntWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -195,7 +195,7 @@ def put_long( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.LongWrapper) + body_content = self._serialize.body(complex_body, 'LongWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -284,7 +284,7 @@ def put_float( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.FloatWrapper) + body_content = self._serialize.body(complex_body, 'FloatWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -374,7 +374,7 @@ def put_double( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.DoubleWrapper) + body_content = self._serialize.body(complex_body, 'DoubleWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -463,7 +463,7 @@ def put_bool( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.BooleanWrapper) + body_content = self._serialize.body(complex_body, 'BooleanWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -552,7 +552,7 @@ def put_string( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.StringWrapper) + body_content = self._serialize.body(complex_body, 'StringWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -641,7 +641,7 @@ def put_date( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.DateWrapper) + body_content = self._serialize.body(complex_body, 'DateWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -731,7 +731,7 @@ def put_date_time( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.DatetimeWrapper) + body_content = self._serialize.body(complex_body, 'DatetimeWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -821,7 +821,7 @@ def put_date_time_rfc1123( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.Datetimerfc1123Wrapper) + body_content = self._serialize.body(complex_body, 'Datetimerfc1123Wrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -911,7 +911,7 @@ def put_duration( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.DurationWrapper) + body_content = self._serialize.body(complex_body, 'DurationWrapper') # Construct and send request request = self._client.put(url, query_parameters) @@ -1001,7 +1001,7 @@ def put_byte( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.ByteWrapper) + body_content = self._serialize.body(complex_body, 'ByteWrapper') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py index 3ad3012adf2b..fde563ffc3a2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py @@ -106,7 +106,7 @@ def put_valid( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(complex_body, models.ReadonlyObj) + body_content = self._serialize.body(complex_body, 'ReadonlyObj') # Construct and send request request = self._client.put(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/auto_rest_date_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/auto_rest_date_test_service.py index d589aef9c078..c37507db7fdd 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/auto_rest_date_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/auto_rest_date_test_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.date_model = DateModel( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/auto_rest_date_time_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/auto_rest_date_time_test_service.py index 63020ce19098..a7189bd413fd 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/auto_rest_date_time_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/auto_rest_date_time_test_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.datetime_model = DatetimeModel( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/auto_rest_rfc1123_date_time_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/auto_rest_rfc1123_date_time_test_service.py index fb3ccf262d9a..8ba043959a65 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/auto_rest_rfc1123_date_time_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/auto_rest_rfc1123_date_time_test_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.datetimerfc1123 = Datetimerfc1123( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/auto_rest_swagger_ba_tdictionary_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/auto_rest_swagger_ba_tdictionary_service.py index c8fd56f67c1f..7ec28039bc2a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/auto_rest_swagger_ba_tdictionary_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/auto_rest_swagger_ba_tdictionary_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.dictionary = Dictionary( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py index 23ffff520466..6160f38a6901 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/auto_rest_duration_test_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.duration = Duration( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/auto_rest_swagger_bat_file_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/auto_rest_swagger_bat_file_service.py index aa002c6d14bb..b7b44c72d654 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/auto_rest_swagger_bat_file_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/auto_rest_swagger_bat_file_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.files = Files( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/auto_rest_swagger_bat_form_data_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/auto_rest_swagger_bat_form_data_service.py index 5dab02ffeb01..07c4464eea55 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/auto_rest_swagger_bat_form_data_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/auto_rest_swagger_bat_form_data_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.formdata = Formdata( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/auto_rest_integer_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/auto_rest_integer_test_service.py index cb2b63aeb46f..86c9440c50bf 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/auto_rest_integer_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/auto_rest_integer_test_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.int_model = IntModel( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/auto_rest_number_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/auto_rest_number_test_service.py index cbc51e4caf41..0f445b717a5e 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/auto_rest_number_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/auto_rest_number_test_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.number = Number( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/auto_rest_swagger_bat_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/auto_rest_swagger_bat_service.py index d2aca590c6fa..cb1ce26901fe 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/auto_rest_swagger_bat_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/auto_rest_swagger_bat_service.py @@ -59,7 +59,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.string = String( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py index bbed94ec1caf..14b292dfa638 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/auto_rest_parameterized_host_test_client.py @@ -65,7 +65,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.paths = Paths( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/auto_rest_parameterized_custom_host_test_client.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/auto_rest_parameterized_custom_host_test_client.py index 3b659079f192..9e5500f342c2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/auto_rest_parameterized_custom_host_test_client.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/auto_rest_parameterized_custom_host_test_client.py @@ -74,7 +74,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.paths = Paths( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/auto_rest_swagger_bat_header_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/auto_rest_swagger_bat_header_service.py index 353542329d89..2b6e1e65a98a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/auto_rest_swagger_bat_header_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/auto_rest_swagger_bat_header_service.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.header = Header( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/auto_rest_http_infrastructure_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/auto_rest_http_infrastructure_test_service.py index c7c9308ea102..c830f26bc2c6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/auto_rest_http_infrastructure_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/auto_rest_http_infrastructure_test_service.py @@ -74,7 +74,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.http_failure = HttpFailure( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py index 2c737ce3767d..843afe11e490 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py @@ -53,7 +53,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -271,7 +271,7 @@ def put_resource_collection( # Construct body if resource_complex_object is not None: - body_content = self._serialize.body(resource_complex_object, models.ResourceCollection) + body_content = self._serialize.body(resource_complex_object, 'ResourceCollection') else: body_content = None @@ -364,7 +364,7 @@ def put_simple_product( # Construct body if simple_body_product is not None: - body_content = self._serialize.body(simple_body_product, models.SimpleProduct) + body_content = self._serialize.body(simple_body_product, 'SimpleProduct') else: body_content = None @@ -433,7 +433,7 @@ def post_flattened_simple_product( # Construct body if simple_body_product is not None: - body_content = self._serialize.body(simple_body_product, models.SimpleProduct) + body_content = self._serialize.body(simple_body_product, 'SimpleProduct') else: body_content = None @@ -515,7 +515,7 @@ def put_simple_product_with_grouping( # Construct body if simple_body_product is not None: - body_content = self._serialize.body(simple_body_product, models.SimpleProduct) + body_content = self._serialize.body(simple_body_product, 'SimpleProduct') else: body_content = None diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/auto_rest_parameter_flattening.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/auto_rest_parameter_flattening.py index 35cc30f5052d..b3c9a71e2c1f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/auto_rest_parameter_flattening.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/auto_rest_parameter_flattening.py @@ -56,7 +56,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.availability_sets = AvailabilitySets( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py index 5728b0ee3d15..ec69672916dc 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py @@ -72,7 +72,7 @@ def update( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(tags1, models.AvailabilitySetUpdateParameters) + body_content = self._serialize.body(tags1, 'AvailabilitySetUpdateParameters') # Construct and send request request = self._client.patch(url, query_parameters) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py index 31aeda82eab3..59192a6fd23b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py @@ -53,7 +53,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/auto_rest_required_optional_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/auto_rest_required_optional_test_service.py index d9549ba15ea8..c22c57d10fdb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/auto_rest_required_optional_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/auto_rest_required_optional_test_service.py @@ -83,7 +83,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.implicit = Implicit( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py index f4f0239b0e48..4f56d1d617c0 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py @@ -156,7 +156,7 @@ def post_required_integer_property( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, models.IntWrapper) + body_content = self._serialize.body(body_parameter, 'IntWrapper') # Construct and send request request = self._client.post(url, query_parameters) @@ -205,7 +205,7 @@ def post_optional_integer_property( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, models.IntOptionalWrapper) + body_content = self._serialize.body(body_parameter, 'IntOptionalWrapper') else: body_content = None @@ -431,7 +431,7 @@ def post_required_string_property( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, models.StringWrapper) + body_content = self._serialize.body(body_parameter, 'StringWrapper') # Construct and send request request = self._client.post(url, query_parameters) @@ -480,7 +480,7 @@ def post_optional_string_property( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, models.StringOptionalWrapper) + body_content = self._serialize.body(body_parameter, 'StringOptionalWrapper') else: body_content = None @@ -613,7 +613,7 @@ def post_required_class_parameter( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, models.Product) + body_content = self._serialize.body(body_parameter, 'Product') # Construct and send request request = self._client.post(url, query_parameters) @@ -658,7 +658,7 @@ def post_optional_class_parameter( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, models.Product) + body_content = self._serialize.body(body_parameter, 'Product') else: body_content = None @@ -709,7 +709,7 @@ def post_required_class_property( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, models.ClassWrapper) + body_content = self._serialize.body(body_parameter, 'ClassWrapper') # Construct and send request request = self._client.post(url, query_parameters) @@ -759,7 +759,7 @@ def post_optional_class_property( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, models.ClassOptionalWrapper) + body_content = self._serialize.body(body_parameter, 'ClassOptionalWrapper') else: body_content = None @@ -900,7 +900,7 @@ def post_required_array_property( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(body_parameter, models.ArrayWrapper) + body_content = self._serialize.body(body_parameter, 'ArrayWrapper') # Construct and send request request = self._client.post(url, query_parameters) @@ -949,7 +949,7 @@ def post_optional_array_property( # Construct body if body_parameter is not None: - body_content = self._serialize.body(body_parameter, models.ArrayOptionalWrapper) + body_content = self._serialize.body(body_parameter, 'ArrayOptionalWrapper') else: body_content = None diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/auto_rest_url_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/auto_rest_url_test_service.py index 0c6834405656..a6d660a1c267 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/auto_rest_url_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/auto_rest_url_test_service.py @@ -81,7 +81,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.paths = Paths( diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py index 9d63617ddbbf..328b2b477650 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py @@ -73,7 +73,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -178,7 +178,7 @@ def validation_of_body( # Construct body if body is not None: - body_content = self._serialize.body(body, models.Product) + body_content = self._serialize.body(body, 'Product') else: body_content = None @@ -280,7 +280,7 @@ def post_with_constant_in_body( # Construct body if body is not None: - body_content = self._serialize.body(body, models.Product) + body_content = self._serialize.body(body, 'Product') else: body_content = None diff --git a/Samples/azure-storage/Azure.Python/storagemanagementclient/operations/storage_accounts_operations.py b/Samples/azure-storage/Azure.Python/storagemanagementclient/operations/storage_accounts_operations.py index e8412716ef69..ef19c00fbeea 100644 --- a/Samples/azure-storage/Azure.Python/storagemanagementclient/operations/storage_accounts_operations.py +++ b/Samples/azure-storage/Azure.Python/storagemanagementclient/operations/storage_accounts_operations.py @@ -71,7 +71,7 @@ def check_name_availability( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(account_name, models.StorageAccountCheckNameAvailabilityParameters) + body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') # Construct and send request request = self._client.post(url, query_parameters) @@ -148,7 +148,7 @@ def create( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, models.StorageAccountCreateParameters) + body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') # Construct and send request def long_running_send(): @@ -380,7 +380,7 @@ def update( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(parameters, models.StorageAccountUpdateParameters) + body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') # Construct and send request request = self._client.patch(url, query_parameters) @@ -650,7 +650,7 @@ def regenerate_key( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - body_content = self._serialize.body(regenerate_key, models.StorageAccountRegenerateKeyParameters) + body_content = self._serialize.body(regenerate_key, 'StorageAccountRegenerateKeyParameters') # Construct and send request request = self._client.post(url, query_parameters) diff --git a/Samples/azure-storage/Azure.Python/storagemanagementclient/storage_management_client.py b/Samples/azure-storage/Azure.Python/storagemanagementclient/storage_management_client.py index 8c665e4cf9c4..5b0b67e87667 100644 --- a/Samples/azure-storage/Azure.Python/storagemanagementclient/storage_management_client.py +++ b/Samples/azure-storage/Azure.Python/storagemanagementclient/storage_management_client.py @@ -109,7 +109,7 @@ def __init__( self._client = ServiceClient(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.storage_accounts = StorageAccountsOperations( diff --git a/Samples/petstore/Python/swaggerpetstore/swagger_petstore.py b/Samples/petstore/Python/swaggerpetstore/swagger_petstore.py index ebc0bb5e009e..ef020f9303a6 100644 --- a/Samples/petstore/Python/swaggerpetstore/swagger_petstore.py +++ b/Samples/petstore/Python/swaggerpetstore/swagger_petstore.py @@ -47,7 +47,7 @@ def __init__( self._client = ServiceClient(None, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer() + self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -128,7 +128,7 @@ def add_pet( # Construct body if body is not None: - body_content = self._serialize.body(body, models.Pet) + body_content = self._serialize.body(body, 'Pet') else: body_content = None @@ -174,7 +174,7 @@ def update_pet( # Construct body if body is not None: - body_content = self._serialize.body(body, models.Pet) + body_content = self._serialize.body(body, 'Pet') else: body_content = None @@ -623,7 +623,7 @@ def place_order( # Construct body if body is not None: - body_content = self._serialize.body(body, models.Order) + body_content = self._serialize.body(body, 'Order') else: body_content = None @@ -774,7 +774,7 @@ def create_user( # Construct body if body is not None: - body_content = self._serialize.body(body, models.User) + body_content = self._serialize.body(body, 'User') else: body_content = None @@ -1059,7 +1059,7 @@ def update_user( # Construct body if body is not None: - body_content = self._serialize.body(body, models.User) + body_content = self._serialize.body(body, 'User') else: body_content = None From 24cd72ee4a0023d3b6a648a5fec266a1b68b2950 Mon Sep 17 00:00:00 2001 From: annatisch Date: Tue, 10 May 2016 15:12:53 -0700 Subject: [PATCH 11/22] review cleanups --- ClientRuntimes/Python/msrest/msrest/serialization.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ClientRuntimes/Python/msrest/msrest/serialization.py b/ClientRuntimes/Python/msrest/msrest/serialization.py index c207aaa063f0..8ac7fcb82385 100644 --- a/ClientRuntimes/Python/msrest/msrest/serialization.py +++ b/ClientRuntimes/Python/msrest/msrest/serialization.py @@ -195,7 +195,7 @@ class Serializer(object): } flattten = re.compile(r"(? Date: Tue, 10 May 2016 15:27:27 -0700 Subject: [PATCH 12/22] Revert "Change body serialization for complex type" This reverts commit 3e34c1695efe9a765bc74d13325c9177d9c4a26d. --- .../AzureLongRunningMethodTemplate.cshtml | 29 +++++------------- .../AzurePagingMethodTemplate.cshtml | 22 +++----------- .../Python/Templates/MethodTemplate.cshtml | 30 +++++-------------- 3 files changed, 19 insertions(+), 62 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml index d7911a126023..78533cd45122 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml @@ -64,32 +64,17 @@ { @:body_content = upload_gen(@parameter.Name) break; - } - } + } } - else if (Model.RequestBody.IsRequired) - { - - if (Model.RequestBody.Type is CompositeType) - { - @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) - } - else - { + } + else if (Model.RequestBody.IsRequired) + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } - } - else - { + } + else + { @:if @Model.RequestBody.Name is not None: - if (Model.RequestBody.Type is CompositeType) - { - @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) - } - else - { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } @:else: @:body_content = None } diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml index 496b19a0bee7..9e3ddbbf618e 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzurePagingMethodTemplate.cshtml @@ -59,27 +59,13 @@ { @:# Construct body if (Model.RequestBody.IsRequired) - { - if (Model.RequestBody.Type is CompositeType) - { - @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) - } - else - { + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } - } - else - { + } + else + { @:if @Model.RequestBody.Name is not None: - if (Model.RequestBody.Type is CompositeType) - { - @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) - } - else - { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } @:else: @:body_content = None } diff --git a/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml b/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml index a97a9c8921c1..6cd57e9b0253 100644 --- a/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Python/Templates/MethodTemplate.cshtml @@ -64,31 +64,17 @@ { @:body_content = self._client.stream_upload(@parameter.Name, callback) break; - } - } - } - else if (Model.RequestBody.IsRequired) - { - if (Model.RequestBody.Type is CompositeType) - { - @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) - } - else - { + } + } + } + else if (Model.RequestBody.IsRequired) + { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } - } - else - { + } + else + { @:if @Model.RequestBody.Name is not None: - if (Model.RequestBody.Type is CompositeType) - { - @:body_content = self._serialize.body(@Model.RequestBody.Name, models.@(Model.RequestBody.Type.ToPythonRuntimeTypeString())) - } - else - { @:body_content = self._serialize.body(@Model.RequestBody.Name, '@(Model.RequestBody.Type.ToPythonRuntimeTypeString())') - } @:else: @:body_content = None } From 1991851bd1d8b658c71bef07371c3ff3155eb8ed Mon Sep 17 00:00:00 2001 From: annatisch Date: Tue, 10 May 2016 15:32:12 -0700 Subject: [PATCH 13/22] Added unix url test --- .../Azure.Python/AutoRest.Generator.Azure.Python.csproj | 4 ---- .../Python/Python.Tests/AcceptanceTests/url_tests.py | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python/AutoRest.Generator.Azure.Python.csproj b/AutoRest/Generators/Python/Azure.Python/AutoRest.Generator.Azure.Python.csproj index 6ebaa9d83e79..913e75195ac1 100644 --- a/AutoRest/Generators/Python/Azure.Python/AutoRest.Generator.Azure.Python.csproj +++ b/AutoRest/Generators/Python/Azure.Python/AutoRest.Generator.Azure.Python.csproj @@ -20,10 +20,6 @@ 4 - - False - ..\..\..\..\..\..\..\CxCache\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll - diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py index 89d714388f71..819725c37854 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py @@ -74,6 +74,7 @@ def test_url_path(self): self.client.paths.date_time_valid(isodate.parse_datetime("2012-01-01T01:01:01Z")) self.client.paths.date_valid(isodate.parse_date("2012-01-01")) + self.client.paths.unix_time_url(datetime(year=2016, month=4, day=13)) self.client.paths.double_decimal_negative(-9999999.999) self.client.paths.double_decimal_positive(9999999.999) From 3e08cfae21cae5e51c3efef7794c83aee1ce979b Mon Sep 17 00:00:00 2001 From: annatisch Date: Tue, 10 May 2016 15:37:50 -0700 Subject: [PATCH 14/22] Regenerated --- .../models/first_parameter_group.py | 4 +--- ...ter_grouping_post_multi_param_groups_second_param_group.py | 3 +-- .../models/parameter_grouping_post_optional_parameters.py | 2 +- .../models/parameter_grouping_post_required_parameters.py | 2 +- .../models/paging_get_multiple_pages_options.py | 2 +- .../models/paging_get_multiple_pages_with_offset_options.py | 2 +- .../models/flatten_parameter_group.py | 2 +- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/first_parameter_group.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/first_parameter_group.py index 172a4349ff36..dec4f136004f 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/first_parameter_group.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/first_parameter_group.py @@ -14,9 +14,7 @@ class FirstParameterGroup(Model): """ - Additional parameters for a set of operations, such as: - parameterGrouping_postMultiParamGroups, - parameterGrouping_postSharedParameterGroupObject. + Additional parameters for one or more operations :param header_one: :type header_one: str diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_multi_param_groups_second_param_group.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_multi_param_groups_second_param_group.py index bccdfab25480..4d4af238358b 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_multi_param_groups_second_param_group.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_multi_param_groups_second_param_group.py @@ -14,8 +14,7 @@ class ParameterGroupingPostMultiParamGroupsSecondParamGroup(Model): """ - Additional parameters for the parameterGrouping_postMultiParamGroups - operation. + Additional parameters for one or more operations :param header_two: :type header_two: str diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_optional_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_optional_parameters.py index a62313adf9a2..623b79fd0fee 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_optional_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_optional_parameters.py @@ -14,7 +14,7 @@ class ParameterGroupingPostOptionalParameters(Model): """ - Additional parameters for the parameterGrouping_postOptional operation. + Additional parameters for one or more operations :param custom_header: :type custom_header: str diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_required_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_required_parameters.py index 409f4ffcdcf2..109ebe5ad51e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_required_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/models/parameter_grouping_post_required_parameters.py @@ -14,7 +14,7 @@ class ParameterGroupingPostRequiredParameters(Model): """ - Additional parameters for the parameterGrouping_postRequired operation. + Additional parameters for one or more operations :param body: :type body: int diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/models/paging_get_multiple_pages_options.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/models/paging_get_multiple_pages_options.py index 15ba71465cac..4fcaf367d51b 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/models/paging_get_multiple_pages_options.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/models/paging_get_multiple_pages_options.py @@ -14,7 +14,7 @@ class PagingGetMultiplePagesOptions(Model): """ - Additional parameters for the Paging_getMultiplePages operation. + Additional parameters for one or more operations :param maxresults: Sets the maximum number of items to return in the response. diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/models/paging_get_multiple_pages_with_offset_options.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/models/paging_get_multiple_pages_with_offset_options.py index 23e7a887f274..48ed388233da 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/models/paging_get_multiple_pages_with_offset_options.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/models/paging_get_multiple_pages_with_offset_options.py @@ -14,7 +14,7 @@ class PagingGetMultiplePagesWithOffsetOptions(Model): """ - Additional parameters for the Paging_getMultiplePagesWithOffset operation. + Additional parameters for one or more operations :param maxresults: Sets the maximum number of items to return in the response. diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/flatten_parameter_group.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/flatten_parameter_group.py index ef30dd1f2d03..3e66e6a883e4 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/flatten_parameter_group.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/flatten_parameter_group.py @@ -14,7 +14,7 @@ class FlattenParameterGroup(Model): """ - Additional parameters for the putSimpleProductWithGrouping operation. + Additional parameters for one or more operations :param name: Product name with value 'groupproduct' :type name: str From 914f60fa4d679a1733d47e447c4caa132e8e5135 Mon Sep 17 00:00:00 2001 From: annatisch Date: Wed, 11 May 2016 13:14:31 -0700 Subject: [PATCH 15/22] Added support for base64url serialization --- .../AcceptanceTests/array_tests.py | 3 +++ .../AcceptanceTests/custom_base_uri_tests.py | 6 +++++ .../AcceptanceTests/dictionary_tests.py | 5 ++++ .../AcceptanceTests/string_tests.py | 5 ++++ .../Python.Tests/AcceptanceTests/url_tests.py | 2 ++ .../operations/array.py | 2 +- .../operations/dictionary.py | 2 +- .../operations/string.py | 8 +++--- .../operations/paths.py | 2 +- .../Python/Python/ClientModelExtensions.cs | 8 +++++- AutoRest/TestServer/server/app.js | 6 ++--- .../Python/msrest/msrest/serialization.py | 26 +++++++++++++++++++ 12 files changed, 64 insertions(+), 11 deletions(-) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py index 9b14f19b3966..0b9a56ff2c9f 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py @@ -208,6 +208,9 @@ def test_array(self): with self.assertRaises(DeserializationError): client.array.get_date_time_invalid_chars() + test_array = ['a string that gets encoded with base64url', 'test string', 'Lorem ipsum'] + self.assertEqual(client.array.get_base64_url(), test_array) + if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/custom_base_uri_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/custom_base_uri_tests.py index 38c16c2a7a14..d1a49930ec38 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/custom_base_uri_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/custom_base_uri_tests.py @@ -39,6 +39,7 @@ tests = realpath(join(cwd, pardir, "Expected", "AcceptanceTests")) sys.path.append(join(tests, "CustomBaseUri")) +sys.path.append(join(tests, "CustomBaseUriMoreOptions")) from msrest.exceptions import ( DeserializationError, @@ -48,6 +49,7 @@ from autorestparameterizedhosttestclient import AutoRestParameterizedHostTestClient from autorestparameterizedhosttestclient.models import Error, ErrorException +from autorestparameterizedcustomhosttestclient import AutoRestParameterizedCustomHostTestClient class CustomBaseUriTests(unittest.TestCase): @@ -70,6 +72,10 @@ def test_custom_base_uri_negative(self): with self.assertRaises(ClientRequestError): client.paths.get_empty("local") + def test_custom_base_uri_more_optiopns(self): + client = AutoRestParameterizedCustomHostTestClient("test12", "host.:3000") + client.paths.get_empty("http://lo", "cal", "key1") + if __name__ == '__main__': diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py index fdb8cc180c83..a3dc4cef36f4 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py @@ -182,6 +182,11 @@ def test_dictionary_primitive_types(self): bytes_result = self.client.dictionary.get_byte_invalid_null() self.assertEqual(bytes_null, bytes_result) + test_dict = {'0': 'a string that gets encoded with base64url', + '1': 'test string', + '2': 'Lorem ipsum'} + self.assertEqual(self.client.dictionary.get_base64_url(), test_dict) + def test_basic_dictionary_parsing(self): self.assertEqual({}, self.client.dictionary.get_empty()) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py index 6c4e1e2ca5af..c012b3e9407c 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py @@ -104,6 +104,11 @@ def test_string(self): self.assertEqual(Colors.redcolor, client.enum.get_not_expandable()) client.enum.put_not_expandable(Colors.redcolor) + self.assertEqual(client.string.get_base64_encoded(), 'a string that gets encoded with base64') + self.assertEqual(client.string.get_base64_url_encoded(), 'a string that gets encoded with base64url') + self.assertIsNone(client.string.get_null_base64_url_encoded()) + client.string.put_base64_url_encoded('a string that gets encoded with base64url') + if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py index 819725c37854..9eee73e422f2 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py @@ -101,6 +101,8 @@ def test_url_path(self): with self.assertRaises(ValidationError): self.client.paths.enum_null(None) + self.client.paths.base64_url("lorem") + def test_url_query(self): self.client.config.global_string_path = '' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py index 1d437ec67f87..cf60a316ab36 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py @@ -2090,7 +2090,7 @@ def get_base64_url( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('[str]', response) + deserialized = self._deserialize('[base64]', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/operations/dictionary.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/operations/dictionary.py index 55fd8ef1953d..ef93fea23fd6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/operations/dictionary.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/operations/dictionary.py @@ -2095,7 +2095,7 @@ def get_base64_url( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('{str}', response) + deserialized = self._deserialize('{base64}', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py index 5910495329f8..854f52c97752 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py @@ -473,7 +473,7 @@ def get_base64_encoded( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('base64', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -517,7 +517,7 @@ def get_base64_url_encoded( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('base64', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -554,7 +554,7 @@ def put_base64_url_encoded( header_parameters.update(custom_headers) # Construct body - body_content = self._serialize.body(string_body, 'str') + body_content = self._serialize.body(string_body, 'base64') # Construct and send request request = self._client.put(url, query_parameters) @@ -604,7 +604,7 @@ def get_null_base64_url_encoded( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('str', response) + deserialized = self._deserialize('base64', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py index 3e6e638a031b..c0e56ad99721 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py @@ -1046,7 +1046,7 @@ def base64_url( # Construct URL url = '/paths/string/bG9yZW0/{base64UrlPath}' path_format_arguments = { - 'base64UrlPath': self._serialize.url("base64_url_path", base64_url_path, 'str') + 'base64UrlPath': self._serialize.url("base64_url_path", base64_url_path, 'base64') } url = self._client.format_url(url, **path_format_arguments) diff --git a/AutoRest/Generators/Python/Python/ClientModelExtensions.cs b/AutoRest/Generators/Python/Python/ClientModelExtensions.cs index 330d8aef564c..00622b4d9e1a 100644 --- a/AutoRest/Generators/Python/Python/ClientModelExtensions.cs +++ b/AutoRest/Generators/Python/Python/ClientModelExtensions.cs @@ -152,6 +152,11 @@ public static string ToPythonRuntimeTypeString(this IType type) { return "unix-time"; } + + if (known.Type == KnownPrimaryType.Base64Url) + { + return "base64"; + } } var sequenceType = type as SequenceType; @@ -252,7 +257,8 @@ public static string GetPythonSerializationType(IType type) { KnownPrimaryType.DateTime, "iso-8601" }, { KnownPrimaryType.DateTimeRfc1123, "rfc-1123" }, { KnownPrimaryType.TimeSpan, "duration" }, - { KnownPrimaryType.UnixTime, "unix-time" } + { KnownPrimaryType.UnixTime, "unix-time" }, + { KnownPrimaryType.Base64Url, "base64" } }; PrimaryType primaryType = type as PrimaryType; if (primaryType != null) diff --git a/AutoRest/TestServer/server/app.js b/AutoRest/TestServer/server/app.js index 9453e73965c2..a462baa91787 100644 --- a/AutoRest/TestServer/server/app.js +++ b/AutoRest/TestServer/server/app.js @@ -419,7 +419,7 @@ var coverage = { "ConstantsInPath": 0, "ConstantsInBody": 0, "CustomBaseUri": 0, - //Once all the languages implement this test, the scenario counter should be reset to zero. It is currently implemented in C# and node.js + //Once all the languages implement this test, the scenario counter should be reset to zero. It is currently implemented in C#, Python and node.js "CustomBaseUriMoreOptions": 1, 'getModelFlattenArray': 0, 'putModelFlattenArray': 0, @@ -430,7 +430,7 @@ var coverage = { 'putModelFlattenCustomBase': 0, 'postModelFlattenCustomParameter': 0, 'putModelFlattenCustomGroupedParameter': 0, - /* TODO: only C# and node.js support the base64url format currently. Exclude these tests from code coverage until it is implemented in other languages */ + /* TODO: only C#, Python and node.js support the base64url format currently. Exclude these tests from code coverage until it is implemented in other languages */ "getStringBase64Encoded": 1, "getStringBase64UrlEncoded": 1, "putStringBase64UrlEncoded": 1, @@ -439,7 +439,7 @@ var coverage = { "getDictionaryBase64Url": 1, "UrlPathsStringBase64Url": 1, "UrlPathsArrayCSVInPath": 1, - /* TODO: only C# supports the unixtime format currently. Exclude these tests from code coverage until it is implemented in other languages */ + /* TODO: only C# and Python support the unixtime format currently. Exclude these tests from code coverage until it is implemented in other languages */ "getUnixTime": 1, "getInvalidUnixTime": 1, "getNullUnixTime": 1, diff --git a/ClientRuntimes/Python/msrest/msrest/serialization.py b/ClientRuntimes/Python/msrest/msrest/serialization.py index 8ac7fcb82385..ef16b011e4b7 100644 --- a/ClientRuntimes/Python/msrest/msrest/serialization.py +++ b/ClientRuntimes/Python/msrest/msrest/serialization.py @@ -205,6 +205,7 @@ def __init__(self, classes=None): 'decimal': Serializer.serialize_decimal, 'long': Serializer.serialize_long, 'bytearray': Serializer.serialize_bytearray, + 'base64': Serializer.serialize_base64, 'object': self.serialize_object, '[]': self.serialize_iter, '{}': self.serialize_dict @@ -541,6 +542,16 @@ def serialize_bytearray(attr, **kwargs): """ return b64encode(attr).decode() + @staticmethod + def serialize_base64(attr, **kwargs): + """Serialize str into base-64 string. + + :param attr: Object to be serialized. + :rtype: str + """ + encoded = b64encode(attr.encode()).decode() + return encoded.strip('=').replace('+', '-').replace('/', '_') + @staticmethod def serialize_decimal(attr, **kwargs): """Serialize Decimal object to float. @@ -675,6 +686,7 @@ def __init__(self, classes=None): 'decimal': Deserializer.deserialize_decimal, 'long': Deserializer.deserialize_long, 'bytearray': Deserializer.deserialize_bytearray, + 'base64': Deserializer.deserialize_base64, 'object': self.deserialize_object, '[]': self.deserialize_iter, '{}': self.deserialize_dict @@ -985,6 +997,20 @@ def deserialize_bytearray(attr): """ return bytearray(b64decode(attr)) + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :rtype: bytearray + :raises: TypeError if string format invalid. + """ + pad_count = 3 - (len(attr) + 3) % 4 + padding = ['='] * pad_count + attr = attr + ''.join(padding) + encoded = attr.replace('-', '+').replace('_', '/') + return b64decode(encoded).decode() + @staticmethod def deserialize_decimal(attr): """Deserialize string into Decimal object. From 1d37145c24c01e99409e59d470ec902382aac41f Mon Sep 17 00:00:00 2001 From: annatisch Date: Thu, 12 May 2016 09:27:49 -0700 Subject: [PATCH 16/22] removed base64 encoding/decoding --- .../Python.Tests/AcceptanceTests/array_tests.py | 4 +++- .../AcceptanceTests/dictionary_tests.py | 6 +++--- .../Python.Tests/AcceptanceTests/string_tests.py | 6 +++--- .../Python.Tests/AcceptanceTests/url_tests.py | 2 +- .../Python/msrest/msrest/serialization.py | 13 ++++++++----- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py index 0b9a56ff2c9f..c919eeb450eb 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/array_tests.py @@ -208,7 +208,9 @@ def test_array(self): with self.assertRaises(DeserializationError): client.array.get_date_time_invalid_chars() - test_array = ['a string that gets encoded with base64url', 'test string', 'Lorem ipsum'] + test_array = ['a string that gets encoded with base64url'.encode(), + 'test string'.encode(), + 'Lorem ipsum'.encode()] self.assertEqual(client.array.get_base64_url(), test_array) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py index a3dc4cef36f4..477591ffa9f4 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/dictionary_tests.py @@ -182,9 +182,9 @@ def test_dictionary_primitive_types(self): bytes_result = self.client.dictionary.get_byte_invalid_null() self.assertEqual(bytes_null, bytes_result) - test_dict = {'0': 'a string that gets encoded with base64url', - '1': 'test string', - '2': 'Lorem ipsum'} + test_dict = {'0': 'a string that gets encoded with base64url'.encode(), + '1': 'test string'.encode(), + '2': 'Lorem ipsum'.encode()} self.assertEqual(self.client.dictionary.get_base64_url(), test_dict) def test_basic_dictionary_parsing(self): diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py index c012b3e9407c..93c4d937535c 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py @@ -104,10 +104,10 @@ def test_string(self): self.assertEqual(Colors.redcolor, client.enum.get_not_expandable()) client.enum.put_not_expandable(Colors.redcolor) - self.assertEqual(client.string.get_base64_encoded(), 'a string that gets encoded with base64') - self.assertEqual(client.string.get_base64_url_encoded(), 'a string that gets encoded with base64url') + self.assertEqual(client.string.get_base64_encoded(), 'a string that gets encoded with base64'.encode()) + self.assertEqual(client.string.get_base64_url_encoded(), 'a string that gets encoded with base64url'.encode()) self.assertIsNone(client.string.get_null_base64_url_encoded()) - client.string.put_base64_url_encoded('a string that gets encoded with base64url') + client.string.put_base64_url_encoded('a string that gets encoded with base64url'.encode()) if __name__ == '__main__': diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py index 9eee73e422f2..04e4c94e359a 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/url_tests.py @@ -101,7 +101,7 @@ def test_url_path(self): with self.assertRaises(ValidationError): self.client.paths.enum_null(None) - self.client.paths.base64_url("lorem") + self.client.paths.base64_url("lorem".encode()) def test_url_query(self): diff --git a/ClientRuntimes/Python/msrest/msrest/serialization.py b/ClientRuntimes/Python/msrest/msrest/serialization.py index ef16b011e4b7..b2c7e67ca57a 100644 --- a/ClientRuntimes/Python/msrest/msrest/serialization.py +++ b/ClientRuntimes/Python/msrest/msrest/serialization.py @@ -447,6 +447,10 @@ def serialize_unicode(self, data): :param data: Object to be serialized. :rtype: str """ + try: + return data.value + except AttributeError: + pass try: if isinstance(data, unicode): return data.encode(encoding='utf-8') @@ -549,7 +553,7 @@ def serialize_base64(attr, **kwargs): :param attr: Object to be serialized. :rtype: str """ - encoded = b64encode(attr.encode()).decode() + encoded = b64encode(attr).decode('ascii') return encoded.strip('=').replace('+', '-').replace('/', '_') @staticmethod @@ -1005,11 +1009,10 @@ def deserialize_base64(attr): :rtype: bytearray :raises: TypeError if string format invalid. """ - pad_count = 3 - (len(attr) + 3) % 4 - padding = ['='] * pad_count - attr = attr + ''.join(padding) + padding = '=' * (3 - (len(attr) + 3) % 4) + attr = attr + padding encoded = attr.replace('-', '+').replace('_', '/') - return b64decode(encoded).decode() + return b64decode(encoded) @staticmethod def deserialize_decimal(attr): From 4104a5688b002844441657d603407c7a94c24cb6 Mon Sep 17 00:00:00 2001 From: annatisch Date: Fri, 13 May 2016 13:51:32 -0700 Subject: [PATCH 17/22] Support for x-ms-enum ModelAsString --- .../models/check_name_availability_result.py | 3 ++- .../models/storage_account.py | 12 ++++++---- .../storage_account_create_parameters.py | 3 ++- ...orage_account_regenerate_key_parameters.py | 3 ++- .../storage_account_update_parameters.py | 3 ++- .../storagemanagementclient/models/usage.py | 3 ++- .../operations/storage_accounts_operations.py | 3 ++- .../AcceptanceTests/complex_tests.py | 4 +++- .../AcceptanceTests/header_tests.py | 1 + .../AcceptanceTests/string_tests.py | 5 +++- .../operations/array.py | 2 +- .../models/basic.py | 5 ++-- .../operations/enum.py | 5 ++-- .../operations/string.py | 8 +++---- .../operations/header.py | 3 ++- .../operations/paths.py | 8 ++++--- .../operations/queries.py | 6 +++-- .../autorestvalidationtest/models/product.py | 3 ++- .../Python/Python/ClientModelExtensions.cs | 12 ++++++++++ .../Python/Python/PythonCodeNamer.cs | 5 ++-- .../TemplateModels/MethodTemplateModel.cs | 17 +++++++++---- .../TemplateModels/ModelTemplateModel.cs | 5 ++-- .../Python/msrest/msrest/serialization.py | 24 ++++++++++++++++--- 23 files changed, 103 insertions(+), 40 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/check_name_availability_result.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/check_name_availability_result.py index cc1c87848bdf..dc3874fdaac0 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/check_name_availability_result.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/check_name_availability_result.py @@ -23,7 +23,8 @@ class CheckNameAvailabilityResult(Model): :param reason: 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' - :type reason: str + :type reason: str or :class:`Reason + ` :param message: Gets an error message explaining the Reason value in more detail. :type message: str diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account.py index bff1707d7807..8ed5eace271c 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account.py @@ -32,11 +32,13 @@ class StorageAccount(Resource): :param provisioning_state: Gets the status of the storage account at the time the operation was called. Possible values include: 'Creating', 'ResolvingDNS', 'Succeeded' - :type provisioning_state: str + :type provisioning_state: str or :class:`ProvisioningState + ` :param account_type: Gets the type of the storage account. Possible values include: 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS' - :type account_type: str + :type account_type: str or :class:`AccountType + ` :param primary_endpoints: Gets the URLs that are used to perform a retrieval of a public blob, queue or table object.Note that StandardZRS and PremiumLRS accounts only return the blob endpoint. @@ -48,7 +50,8 @@ class StorageAccount(Resource): :param status_of_primary: Gets the status indicating whether the primary location of the storage account is available or unavailable. Possible values include: 'Available', 'Unavailable' - :type status_of_primary: str + :type status_of_primary: str or :class:`AccountStatus + ` :param last_geo_failover_time: 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 @@ -63,7 +66,8 @@ class StorageAccount(Resource): secondary location of the storage account is available or unavailable. Only available if the accountType is StandardGRS or StandardRAGRS. Possible values include: 'Available', 'Unavailable' - :type status_of_secondary: str + :type status_of_secondary: str or :class:`AccountStatus + ` :param creation_time: Gets the creation date and time of the storage account in UTC. :type creation_time: datetime diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_create_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_create_parameters.py index 31535a2dc8c2..33c7e0b3d7bc 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_create_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_create_parameters.py @@ -32,7 +32,8 @@ class StorageAccountCreateParameters(Resource): :param account_type: Gets or sets the account type. Possible values include: 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS' - :type account_type: str + :type account_type: str or :class:`AccountType + ` """ _validation = { diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_regenerate_key_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_regenerate_key_parameters.py index 7fe2da5d5672..7a1da3a0e575 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_regenerate_key_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_regenerate_key_parameters.py @@ -16,7 +16,8 @@ class StorageAccountRegenerateKeyParameters(Model): """StorageAccountRegenerateKeyParameters :param key_name: Possible values include: 'key1', 'key2' - :type key_name: str + :type key_name: str or :class:`KeyName + ` """ _attribute_map = { diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_update_parameters.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_update_parameters.py index e60b187d613b..f858c85e39aa 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_update_parameters.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/storage_account_update_parameters.py @@ -34,7 +34,8 @@ class StorageAccountUpdateParameters(Resource): other account types cannot be changed to StandardZRS or PremiumLRS. Possible values include: 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS' - :type account_type: str + :type account_type: str or :class:`AccountType + ` :param custom_domain: User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/usage.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/usage.py index 53d96b70adf1..9b3983b234a5 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/usage.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/models/usage.py @@ -19,7 +19,8 @@ class Usage(Model): :param unit: Gets the unit of measurement. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountsPerSecond', 'BytesPerSecond' - :type unit: str + :type unit: str or :class:`UsageUnit + ` :param current_value: Gets the current count of the allocated resources in the subscription. :type current_value: int diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py index 2250ab10c146..8d54b890d73f 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py @@ -619,7 +619,8 @@ def regenerate_key( only. :type account_name: str :param key_name: Possible values include: 'key1', 'key2' - :type key_name: str + :type key_name: str or :class:`KeyName + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py index 88d8e9ee7db3..fa065c09c6e6 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py @@ -68,9 +68,11 @@ def test_complex(self): basic_result = client.basic_operations.get_valid() self.assertEqual(2, basic_result.id) self.assertEqual("abc", basic_result.name); - self.assertEqual(CMYKColors.yellow, basic_result.color); + self.assertEqual(CMYKColors.yellow.value, basic_result.color); # PUT basic/valid + basic_result = Basic(id=2, name='abc', color="Magenta") + client.basic_operations.put_valid(basic_result) basic_result = Basic(id=2, name='abc', color=CMYKColors.magenta) client.basic_operations.put_valid(basic_result) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/header_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/header_tests.py index ef5ccdbec97a..e6649e6378f0 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/header_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/header_tests.py @@ -107,6 +107,7 @@ def test_headers(self): self.assertEqual("", raw.headers.get("value")) client.header.param_enum("valid", GreyscaleColors.grey) + client.header.param_enum("valid", 'GREY') client.header.param_enum("null", None) raw = client.header.response_enum("valid", raw=True) diff --git a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py index 93c4d937535c..4236d75b66ed 100644 --- a/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py +++ b/AutoRest/Generators/Python/Python.Tests/AcceptanceTests/string_tests.py @@ -44,7 +44,7 @@ sys.path.append(join(tests, "BodyString")) from msrest.serialization import Deserializer -from msrest.exceptions import DeserializationError +from msrest.exceptions import DeserializationError, SerializationError from autorestswaggerbatservice import AutoRestSwaggerBATService from autorestswaggerbatservice.models.auto_rest_swagger_bat_service_enums import * @@ -102,7 +102,10 @@ def test_string(self): self.assertIsNone(client.string.get_not_provided()) self.assertEqual(Colors.redcolor, client.enum.get_not_expandable()) + client.enum.put_not_expandable('red color') client.enum.put_not_expandable(Colors.redcolor) + with self.assertRaises(SerializationError): + client.enum.put_not_expandable('not a colour') self.assertEqual(client.string.get_base64_encoded(), 'a string that gets encoded with base64'.encode()) self.assertEqual(client.string.get_base64_url_encoded(), 'a string that gets encoded with base64url'.encode()) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py index cf60a316ab36..51e2f30f7330 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py @@ -2064,7 +2064,7 @@ def get_base64_url( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: list of str + :rtype: list of bytes :rtype: :class:`ClientRawResponse` if raw=true """ diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/models/basic.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/models/basic.py index 83a9721456ac..69a638c4f89c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/models/basic.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/models/basic.py @@ -21,13 +21,14 @@ class Basic(Model): :type name: str :param color: Possible values include: 'cyan', 'Magenta', 'YELLOW', 'blacK' - :type color: str + :type color: str or :class:`CMYKColors + ` """ _attribute_map = { 'id': {'key': 'id', 'type': 'int'}, 'name': {'key': 'name', 'type': 'str'}, - 'color': {'key': 'color', 'type': 'CMYKColors'}, + 'color': {'key': 'color', 'type': 'str'}, } def __init__(self, id=None, name=None, color=None): diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/enum.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/enum.py index 3036a22fa9a1..18169ce12b9c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/enum.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/enum.py @@ -42,7 +42,7 @@ def get_not_expandable( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: str + :rtype: :class:`Colors ` :rtype: :class:`ClientRawResponse` if raw=true """ @@ -84,7 +84,8 @@ def put_not_expandable( :param string_body: Possible values include: 'red color', 'green-color', 'blue_color' - :type string_body: str + :type string_body: str or :class:`Colors + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py index 854f52c97752..c6a765bba296 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py @@ -447,7 +447,7 @@ def get_base64_encoded( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: str + :rtype: bytes :rtype: :class:`ClientRawResponse` if raw=true """ @@ -491,7 +491,7 @@ def get_base64_url_encoded( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: str + :rtype: bytes :rtype: :class:`ClientRawResponse` if raw=true """ @@ -531,7 +531,7 @@ def put_base64_url_encoded( Put value that is base64url encoded :param string_body: - :type string_body: str + :type string_body: bytes :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -578,7 +578,7 @@ def get_null_base64_url_encoded( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :rtype: str + :rtype: bytes :rtype: :class:`ClientRawResponse` if raw=true """ diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/operations/header.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/operations/header.py index 55f4a77cbee8..609425c074ab 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/operations/header.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/operations/header.py @@ -1196,7 +1196,8 @@ def param_enum( :type scenario: str :param value: Send a post request with header values 'GREY' . Possible values include: 'White', 'black', 'GREY' - :type value: str + :type value: str or :class:`GreyscaleColors + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py index c0e56ad99721..9084ae4dc964 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py @@ -641,7 +641,8 @@ def enum_valid( :param enum_path: send the value green. Possible values include: 'red color', 'green color', 'blue color' - :type enum_path: str + :type enum_path: str or :class:`UriColor + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -686,7 +687,8 @@ def enum_null( :param enum_path: send null should throw. Possible values include: 'red color', 'green color', 'blue color' - :type enum_path: str + :type enum_path: str or :class:`UriColor + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -1033,7 +1035,7 @@ def base64_url( Get 'lorem' encoded value as 'bG9yZW0' (base64url) :param base64_url_path: base64url encoded value - :type base64_url_path: str + :type base64_url_path: bytes :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/queries.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/queries.py index 4503b7fc304e..b0e4ea195543 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/queries.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/queries.py @@ -805,7 +805,8 @@ def enum_valid( :param enum_query: 'green color' enum value. Possible values include: 'red color', 'green color', 'blue color' - :type enum_query: str + :type enum_query: str or :class:`UriColor + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -847,7 +848,8 @@ def enum_null( :param enum_query: null string value. Possible values include: 'red color', 'green color', 'blue color' - :type enum_query: str + :type enum_query: str or :class:`UriColor + ` :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/models/product.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/models/product.py index 65d49c5d12e1..a8e00da0b080 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/models/product.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/models/product.py @@ -39,7 +39,8 @@ class Product(Model): :vartype const_string: str :param const_string_as_enum: Constant string as Enum. Possible values include: 'constant_string_as_enum' - :type const_string_as_enum: str + :type const_string_as_enum: str or :class:`EnumConst + ` """ _validation = { diff --git a/AutoRest/Generators/Python/Python/ClientModelExtensions.cs b/AutoRest/Generators/Python/Python/ClientModelExtensions.cs index 00622b4d9e1a..131b0ef8a794 100644 --- a/AutoRest/Generators/Python/Python/ClientModelExtensions.cs +++ b/AutoRest/Generators/Python/Python/ClientModelExtensions.cs @@ -159,6 +159,12 @@ public static string ToPythonRuntimeTypeString(this IType type) } } + var enumType = type as EnumType; + if (enumType != null && enumType.ModelAsString) + { + return "str"; + } + var sequenceType = type as SequenceType; if (sequenceType != null) { @@ -307,6 +313,12 @@ public static string GetPythonSerializationType(IType type) return "{" + innerTypeName + "}"; } + EnumType enumType = type as EnumType; + if (enumType != null && enumType.ModelAsString) + { + return "str"; + } + // CompositeType or EnumType return type.Name; } diff --git a/AutoRest/Generators/Python/Python/PythonCodeNamer.cs b/AutoRest/Generators/Python/Python/PythonCodeNamer.cs index bcc2eceecf75..53cbd4e2d938 100644 --- a/AutoRest/Generators/Python/Python/PythonCodeNamer.cs +++ b/AutoRest/Generators/Python/Python/PythonCodeNamer.cs @@ -254,7 +254,7 @@ public override IType NormalizeTypeReference(IType type) return null; } var enumType = type as EnumType; - if (enumType != null && enumType.Name.Length == 0 && enumType.ModelAsString) + if (enumType != null && enumType.Name.Length == 0) { type = new PrimaryType(KnownPrimaryType.String) { @@ -301,6 +301,7 @@ private IType NormalizeEnumType(EnumType enumType) { enumType.Values[i].Name = GetEnumMemberName(enumType.Values[i].Name); } + return enumType; } @@ -326,7 +327,7 @@ private static IType NormalizePrimaryType(PrimaryType primaryType) if (primaryType.Type == KnownPrimaryType.Base64Url) { - primaryType.Name = "str"; + primaryType.Name = "bytes"; } else if (primaryType.Type == KnownPrimaryType.Boolean) { diff --git a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs index ee71dc5b08b4..3ce192fdbb41 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs @@ -436,7 +436,8 @@ protected void AddHeaderDictionary(IndentedStringBuilder builder, CompositeType foreach (var prop in headersType.Properties) { - if (this.ServiceClient.EnumTypes.Contains(prop.Type)) + var enumType = prop.Type as EnumType; + if (this.ServiceClient.EnumTypes.Contains(prop.Type) && !enumType.ModelAsString) { builder.AppendLine(String.Format(CultureInfo.InvariantCulture, "'{0}': models.{1},", prop.SerializedName, prop.Type.ToPythonRuntimeTypeString())); } @@ -555,9 +556,10 @@ public string GetDocumentationType(IType type) } string result = "object"; - + var modelNamespace = ServiceClient.Name.ToPythonCase().Replace("_", ""); var primaryType = type as PrimaryType; var listType = type as SequenceType; + var enumType = type as EnumType; if (primaryType != null) { if (primaryType.Type == KnownPrimaryType.Stream) @@ -575,7 +577,15 @@ public string GetDocumentationType(IType type) } else if (type is EnumType) { - result = "str"; + if (type == ReturnType.Body) + { + if (enumType.ModelAsString) + result = "str"; + else + result = string.Format(CultureInfo.InvariantCulture, ":class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); + } + else + result = string.Format(CultureInfo.InvariantCulture, "str or :class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); } else if (type is DictionaryType) { @@ -583,7 +593,6 @@ public string GetDocumentationType(IType type) } else if (type is CompositeType) { - var modelNamespace = ServiceClient.Name.ToPythonCase().Replace("_", ""); if (!ServiceClient.Namespace.IsNullOrEmpty()) modelNamespace = ServiceClient.Namespace.ToPythonCase().Replace("_", ""); result = string.Format(CultureInfo.InvariantCulture, ":class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); diff --git a/AutoRest/Generators/Python/Python/TemplateModels/ModelTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/ModelTemplateModel.cs index 2c43e7c092ca..8ae4061b940b 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/ModelTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/ModelTemplateModel.cs @@ -465,7 +465,7 @@ public string GetPropertyDocumentationType(IType type) } string result = "object"; - + var modelNamespace = ServiceClient.Name.ToPythonCase().Replace("_", ""); var listType = type as SequenceType; if (type is PrimaryType) { @@ -477,7 +477,7 @@ public string GetPropertyDocumentationType(IType type) } else if (type is EnumType) { - result = "str"; + result = string.Format(CultureInfo.InvariantCulture, "str or :class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); } else if (type is DictionaryType) { @@ -485,7 +485,6 @@ public string GetPropertyDocumentationType(IType type) } else if (type is CompositeType) { - var modelNamespace = ServiceClient.Name.ToPythonCase().Replace("_", ""); if (!ServiceClient.Namespace.IsNullOrEmpty()) modelNamespace = ServiceClient.Namespace.ToPythonCase().Replace("_", ""); result = string.Format(CultureInfo.InvariantCulture, ":class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); diff --git a/ClientRuntimes/Python/msrest/msrest/serialization.py b/ClientRuntimes/Python/msrest/msrest/serialization.py index b2c7e67ca57a..c26596c95659 100644 --- a/ClientRuntimes/Python/msrest/msrest/serialization.py +++ b/ClientRuntimes/Python/msrest/msrest/serialization.py @@ -154,6 +154,8 @@ def _convert_to_datatype(data, data_type, localtypes): key: _convert_to_datatype( data[key], data_type[1:-1], localtypes) for key in data } + elif issubclass(data_obj, Enum): + return data elif not isinstance(data, data_obj): result = { key: _convert_to_datatype( @@ -414,8 +416,9 @@ def serialize_data(self, data, data_type, **kwargs): elif data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) - elif isinstance(data, Enum): - return data.value + enum_type = self.dependencies.get(data_type) + if enum_type and issubclass(enum_type, Enum): + return self.serialize_enum(data, enum_obj=enum_type, **kwargs) iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: @@ -537,6 +540,21 @@ def serialize_object(self, attr, **kwargs): else: return str(attr) + def serialize_enum(self, attr, enum_obj=None, **kwagrs): + try: + return attr.value + except AttributeError: + pass + try: + enum_obj(attr) + return attr + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) + @staticmethod def serialize_bytearray(attr, **kwargs): """Serialize bytearray into base-64 string. @@ -710,7 +728,7 @@ def __call__(self, target_obj, response_data): if isinstance(response, basestring): return self.deserialize_data(data, response) - elif isinstance(response, Enum) or class_name == 'EnumMeta': + elif issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None: From 9f620822ffe7461d6a980888ee78c5641145ccc0 Mon Sep 17 00:00:00 2001 From: annatisch Date: Fri, 13 May 2016 15:03:56 -0700 Subject: [PATCH 18/22] Set customer headers default to None --- .../operations/duration_operations.py | 8 +- .../parameter_grouping_operations.py | 8 +- .../auto_rest_report_service_for_azure.py | 2 +- ...o_rest_resource_flattening_test_service.py | 12 +- .../api_version_default_operations.py | 8 +- .../api_version_local_operations.py | 8 +- .../operations/header_operations.py | 2 +- .../operations/odata_operations.py | 2 +- .../skip_url_encoding_operations.py | 14 +- .../subscription_in_credentials_operations.py | 10 +- .../subscription_in_method_operations.py | 8 +- .../xms_client_request_id_operations.py | 4 +- .../operations/paths_operations.py | 2 +- .../operations/http_success_operations.py | 6 +- .../operations/head_exception_operations.py | 6 +- .../lr_os_custom_header_operations.py | 28 +- .../operations/lr_os_operations.py | 252 ++++++++++-------- .../operations/lro_retrys_operations.py | 49 ++-- .../operations/lrosa_ds_operations.py | 182 +++++++------ .../operations/paging_operations.py | 16 +- .../operations/storage_accounts_operations.py | 23 +- .../operations/usage_operations.py | 2 +- .../operations/group_operations.py | 2 +- .../AzureLongRunningMethodTemplate.cshtml | 5 +- .../operations/array.py | 130 ++++----- .../operations/bool_model.py | 12 +- .../operations/byte.py | 10 +- .../operations/array.py | 10 +- .../operations/basic_operations.py | 12 +- .../operations/dictionary.py | 12 +- .../operations/inheritance.py | 4 +- .../operations/polymorphicrecursive.py | 4 +- .../operations/polymorphism.py | 6 +- .../operations/primitive.py | 44 +-- .../operations/readonlyproperty.py | 4 +- .../operations/date_model.py | 16 +- .../operations/datetime_model.py | 38 +-- .../operations/datetimerfc1123.py | 18 +- .../operations/dictionary.py | 130 ++++----- .../operations/duration.py | 8 +- .../operations/files.py | 6 +- .../operations/formdata.py | 4 +- .../operations/int_model.py | 28 +- .../operations/number.py | 48 ++-- .../operations/enum.py | 4 +- .../operations/string.py | 26 +- .../operations/paths.py | 2 +- .../operations/paths.py | 2 +- .../operations/header.py | 58 ++-- .../operations/http_client_failure.py | 46 ++-- .../operations/http_failure.py | 4 +- .../operations/http_redirects.py | 30 +-- .../operations/http_retry.py | 16 +- .../operations/http_server_failure.py | 8 +- .../operations/http_success.py | 36 +-- .../operations/multiple_responses.py | 68 ++--- ...o_rest_resource_flattening_test_service.py | 18 +- .../operations/availability_sets.py | 2 +- .../auto_rest_report_service.py | 2 +- .../operations/explicit.py | 44 +-- .../operations/implicit.py | 14 +- .../operations/path_items.py | 8 +- .../operations/paths.py | 52 ++-- .../operations/queries.py | 68 ++--- .../auto_rest_validation_test.py | 8 +- .../TemplateModels/MethodTemplateModel.cs | 2 +- 66 files changed, 898 insertions(+), 823 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/operations/duration_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/operations/duration_operations.py index 255f4e6b66f4..db838547b492 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/operations/duration_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureBodyDuration/autorestdurationtestservice/operations/duration_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null duration value @@ -81,7 +81,7 @@ def get_null( return deserialized def put_positive_duration( - self, duration_body, custom_headers={}, raw=False, **operation_config): + self, duration_body, custom_headers=None, raw=False, **operation_config): """ Put a positive duration value @@ -128,7 +128,7 @@ def put_positive_duration( return client_raw_response def get_positive_duration( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a positive duration value @@ -176,7 +176,7 @@ def get_positive_duration( return deserialized def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an invalid duration value diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/operations/parameter_grouping_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/operations/parameter_grouping_operations.py index 673a13914335..27541e740ed8 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/operations/parameter_grouping_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureParameterGrouping/autorestparametergroupingtestservice/operations/parameter_grouping_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def post_required( - self, parameter_grouping_post_required_parameters, custom_headers={}, raw=False, **operation_config): + self, parameter_grouping_post_required_parameters, custom_headers=None, raw=False, **operation_config): """ Post a bunch of required parameters grouped @@ -104,7 +104,7 @@ def post_required( return client_raw_response def post_optional( - self, parameter_grouping_post_optional_parameters=None, custom_headers={}, raw=False, **operation_config): + self, parameter_grouping_post_optional_parameters=None, custom_headers=None, raw=False, **operation_config): """ Post a bunch of optional parameters grouped @@ -161,7 +161,7 @@ def post_optional( return client_raw_response def post_multi_param_groups( - self, first_parameter_group=None, parameter_grouping_post_multi_param_groups_second_param_group=None, custom_headers={}, raw=False, **operation_config): + self, first_parameter_group=None, parameter_grouping_post_multi_param_groups_second_param_group=None, custom_headers=None, raw=False, **operation_config): """ Post parameters from multiple different parameter groups @@ -231,7 +231,7 @@ def post_multi_param_groups( return client_raw_response def post_shared_parameter_group_object( - self, first_parameter_group=None, custom_headers={}, raw=False, **operation_config): + self, first_parameter_group=None, custom_headers=None, raw=False, **operation_config): """ Post parameters with a shared parameter group object diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py index 948ebd96776d..202ecaa8ad4b 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureReport/autorestreportserviceforazure/auto_rest_report_service_for_azure.py @@ -96,7 +96,7 @@ def __init__( def get_report( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get test coverage report diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py index 872a69a82131..4efa7f43c593 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py @@ -96,7 +96,7 @@ def __init__( def put_array( - self, resource_array=None, custom_headers={}, raw=False, **operation_config): + self, resource_array=None, custom_headers=None, raw=False, **operation_config): """ Put External Resource as an Array @@ -147,7 +147,7 @@ def put_array( return client_raw_response def get_array( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get External Resource as an Array @@ -196,7 +196,7 @@ def get_array( return deserialized def put_dictionary( - self, resource_dictionary=None, custom_headers={}, raw=False, **operation_config): + self, resource_dictionary=None, custom_headers=None, raw=False, **operation_config): """ Put External Resource as a Dictionary @@ -246,7 +246,7 @@ def put_dictionary( return client_raw_response def get_dictionary( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get External Resource as a Dictionary @@ -294,7 +294,7 @@ def get_dictionary( return deserialized def put_resource_collection( - self, resource_complex_object=None, custom_headers={}, raw=False, **operation_config): + self, resource_complex_object=None, custom_headers=None, raw=False, **operation_config): """ Put External Resource as a ResourceCollection @@ -346,7 +346,7 @@ def put_resource_collection( return client_raw_response def get_resource_collection( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get External Resource as a ResourceCollection diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/api_version_default_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/api_version_default_operations.py index 77db1896b33a..874e55a3cf60 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/api_version_default_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/api_version_default_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_method_global_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ GET method with api-version modeled in global settings. @@ -75,7 +75,7 @@ def get_method_global_valid( return client_raw_response def get_method_global_not_provided_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ GET method with api-version modeled in global settings. @@ -117,7 +117,7 @@ def get_method_global_not_provided_valid( return client_raw_response def get_path_global_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ GET method with api-version modeled in global settings. @@ -159,7 +159,7 @@ def get_path_global_valid( return client_raw_response def get_swagger_global_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ GET method with api-version modeled in global settings. diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/api_version_local_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/api_version_local_operations.py index 7ba723b1f367..e5b30970f173 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/api_version_local_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/api_version_local_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_method_local_valid( - self, api_version="2.0", custom_headers={}, raw=False, **operation_config): + self, api_version="2.0", custom_headers=None, raw=False, **operation_config): """ Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed @@ -79,7 +79,7 @@ def get_method_local_valid( return client_raw_response def get_method_local_null( - self, api_version=None, custom_headers={}, raw=False, **operation_config): + self, api_version=None, custom_headers=None, raw=False, **operation_config): """ Get method with api-version modeled in the method. pass in api-version = null to succeed @@ -126,7 +126,7 @@ def get_method_local_null( return client_raw_response def get_path_local_valid( - self, api_version="2.0", custom_headers={}, raw=False, **operation_config): + self, api_version="2.0", custom_headers=None, raw=False, **operation_config): """ Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed @@ -172,7 +172,7 @@ def get_path_local_valid( return client_raw_response def get_swagger_local_valid( - self, api_version="2.0", custom_headers={}, raw=False, **operation_config): + self, api_version="2.0", custom_headers=None, raw=False, **operation_config): """ Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/header_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/header_operations.py index c25794e67a22..390042218542 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/header_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/header_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def custom_named_request_id( - self, foo_client_request_id, custom_headers={}, raw=False, **operation_config): + self, foo_client_request_id, custom_headers=None, raw=False, **operation_config): """ Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/odata_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/odata_operations.py index fb33e1238a78..efff53fb9980 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/odata_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/odata_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_with_filter( - self, filter=None, top=None, orderby=None, custom_headers={}, raw=False, **operation_config): + self, filter=None, top=None, orderby=None, custom_headers=None, raw=False, **operation_config): """ Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/skip_url_encoding_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/skip_url_encoding_operations.py index 3e289ed43330..b657cd53af1c 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/skip_url_encoding_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/skip_url_encoding_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_method_path_valid( - self, unencoded_path_param, custom_headers={}, raw=False, **operation_config): + self, unencoded_path_param, custom_headers=None, raw=False, **operation_config): """ Get method with unencoded path parameter with value 'path1/path2/path3' @@ -81,7 +81,7 @@ def get_method_path_valid( return client_raw_response def get_path_path_valid( - self, unencoded_path_param, custom_headers={}, raw=False, **operation_config): + self, unencoded_path_param, custom_headers=None, raw=False, **operation_config): """ Get method with unencoded path parameter with value 'path1/path2/path3' @@ -129,7 +129,7 @@ def get_path_path_valid( return client_raw_response def get_swagger_path_valid( - self, unencoded_path_param="path1/path2/path3", custom_headers={}, raw=False, **operation_config): + self, unencoded_path_param="path1/path2/path3", custom_headers=None, raw=False, **operation_config): """ Get method with unencoded path parameter with value 'path1/path2/path3' @@ -177,7 +177,7 @@ def get_swagger_path_valid( return client_raw_response def get_method_query_valid( - self, q1, custom_headers={}, raw=False, **operation_config): + self, q1, custom_headers=None, raw=False, **operation_config): """ Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3' @@ -223,7 +223,7 @@ def get_method_query_valid( return client_raw_response def get_method_query_null( - self, q1=None, custom_headers={}, raw=False, **operation_config): + self, q1=None, custom_headers=None, raw=False, **operation_config): """ Get method with unencoded query parameter with value null @@ -268,7 +268,7 @@ def get_method_query_null( return client_raw_response def get_path_query_valid( - self, q1, custom_headers={}, raw=False, **operation_config): + self, q1, custom_headers=None, raw=False, **operation_config): """ Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3' @@ -314,7 +314,7 @@ def get_path_query_valid( return client_raw_response def get_swagger_query_valid( - self, q1="value1&q2=value2&q3=value3", custom_headers={}, raw=False, **operation_config): + self, q1="value1&q2=value2&q3=value3", custom_headers=None, raw=False, **operation_config): """ Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3' diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/subscription_in_credentials_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/subscription_in_credentials_operations.py index 7a1f0e632f95..b14e40ea2582 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/subscription_in_credentials_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/subscription_in_credentials_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def post_method_global_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed @@ -79,7 +79,7 @@ def post_method_global_valid( return client_raw_response def post_method_global_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should @@ -126,7 +126,7 @@ def post_method_global_null( return client_raw_response def post_method_global_not_provided_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed @@ -173,7 +173,7 @@ def post_method_global_not_provided_valid( return client_raw_response def post_path_global_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed @@ -219,7 +219,7 @@ def post_path_global_valid( return client_raw_response def post_swagger_global_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/subscription_in_method_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/subscription_in_method_operations.py index a10cf1f70b7e..9386906cae19 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/subscription_in_method_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/subscription_in_method_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def post_method_local_valid( - self, subscription_id, custom_headers={}, raw=False, **operation_config): + self, subscription_id, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed @@ -82,7 +82,7 @@ def post_method_local_valid( return client_raw_response def post_method_local_null( - self, subscription_id, custom_headers={}, raw=False, **operation_config): + self, subscription_id, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you @@ -132,7 +132,7 @@ def post_method_local_null( return client_raw_response def post_path_local_valid( - self, subscription_id, custom_headers={}, raw=False, **operation_config): + self, subscription_id, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed @@ -181,7 +181,7 @@ def post_path_local_valid( return client_raw_response def post_swagger_local_valid( - self, subscription_id, custom_headers={}, raw=False, **operation_config): + self, subscription_id, custom_headers=None, raw=False, **operation_config): """ POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/xms_client_request_id_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/xms_client_request_id_operations.py index 03f60b4d3ea0..d68315d8359f 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/xms_client_request_id_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureSpecials/autorestazurespecialparameterstestclient/operations/xms_client_request_id_operations.py @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -78,7 +78,7 @@ def get( return client_raw_response def param_get( - self, x_ms_client_request_id, custom_headers={}, raw=False, **operation_config): + self, x_ms_client_request_id, custom_headers=None, raw=False, **operation_config): """ Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths_operations.py index a7aaf4792f2e..3e293149bc4e 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_empty( - self, account_name, custom_headers={}, raw=False, **operation_config): + self, account_name, custom_headers=None, raw=False, **operation_config): """ Get a 200 to test a valid base uri diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/operations/http_success_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/operations/http_success_operations.py index e490d4818d39..8f14a81b39a3 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/operations/http_success_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Head/autorestheadtestservice/operations/http_success_operations.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def head200( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 200 status code if successful @@ -77,7 +77,7 @@ def head200( return deserialized def head204( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 204 status code if successful @@ -122,7 +122,7 @@ def head204( return deserialized def head404( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 404 status code if successful diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/operations/head_exception_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/operations/head_exception_operations.py index 4d7d386b4919..65669404b4d1 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/operations/head_exception_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/HeadExceptions/autorestheadexceptiontestservice/operations/head_exception_operations.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def head200( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 200 status code if successful @@ -75,7 +75,7 @@ def head200( return client_raw_response def head204( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 204 status code if successful @@ -118,7 +118,7 @@ def head204( return client_raw_response def head404( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 404 status code if successful diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py index 96ade6d8e3ad..105c79d96f2d 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_custom_header_operations.py @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def put_async_retry_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, @@ -85,10 +85,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -129,7 +130,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put201_creating_succeeded200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, @@ -179,10 +180,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -218,7 +220,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post202_retry200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, @@ -267,10 +269,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -301,7 +304,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_retry_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, @@ -350,10 +353,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py index 4a078a8a86f8..00a39dccab75 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lr_os_operations.py @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def put200_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -82,10 +82,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -119,7 +120,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put200_succeeded_no_state( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that does not contain @@ -167,10 +168,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -204,7 +206,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put202_retry200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that @@ -252,10 +254,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -289,7 +292,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put201_creating_succeeded200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -338,10 +341,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -377,7 +381,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put200_updating_succeeded204( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. @@ -426,10 +430,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -463,7 +468,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put201_creating_failed200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. @@ -512,10 +517,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -551,7 +557,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put200_acceptedcanceled200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -600,10 +606,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -637,7 +644,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_no_header_in_retry( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not @@ -685,10 +692,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -727,7 +735,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_retry_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -776,10 +784,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -820,7 +829,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_no_retry_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -869,10 +878,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -912,7 +922,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_retry_failed( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -961,10 +971,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1005,7 +1016,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_no_retrycanceled( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -1054,10 +1065,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1097,7 +1109,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_no_header_in_retry( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation @@ -1145,10 +1157,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1187,7 +1200,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_non_resource( - self, sku=None, custom_headers={}, raw=False, **operation_config): + self, sku=None, custom_headers=None, raw=False, **operation_config): """ Long running put request with non resource. @@ -1232,10 +1245,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1269,7 +1283,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_non_resource( - self, sku=None, custom_headers={}, raw=False, **operation_config): + self, sku=None, custom_headers=None, raw=False, **operation_config): """ Long running put request with non resource. @@ -1314,10 +1328,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1351,7 +1366,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_sub_resource( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request with sub resource. @@ -1397,10 +1412,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1434,7 +1450,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_sub_resource( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request with sub resource. @@ -1480,10 +1496,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1517,7 +1534,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_provisioning202_accepted200_succeeded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. @@ -1556,10 +1573,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1605,7 +1623,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_provisioning202_deleting_failed200( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -1644,10 +1662,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1693,7 +1712,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_provisioning202_deletingcanceled200( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -1732,10 +1751,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1781,7 +1801,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete204_succeeded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete succeeds and returns right away @@ -1816,10 +1836,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1846,7 +1867,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete202_retry200( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ @@ -1884,10 +1905,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1927,7 +1949,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete202_no_retry204( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ @@ -1965,10 +1987,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2008,7 +2031,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_no_header_in_retry( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain @@ -2045,10 +2068,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2078,7 +2102,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_no_header_in_retry( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status @@ -2115,10 +2139,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2148,7 +2173,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_retry_succeeded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2185,10 +2210,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2220,7 +2246,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_no_retry_succeeded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2257,10 +2283,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2292,7 +2319,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_retry_failed( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2329,10 +2356,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2364,7 +2392,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_retrycanceled( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation @@ -2401,10 +2429,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2436,7 +2465,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post200_with_payload( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response @@ -2474,10 +2503,11 @@ def long_running_send(): request = self._client.post(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2513,7 +2543,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post202_retry200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a @@ -2560,10 +2590,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2594,7 +2625,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post202_no_retry204( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after @@ -2642,10 +2673,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2685,7 +2717,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_retry_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -2734,10 +2766,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2778,7 +2811,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_no_retry_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -2827,10 +2860,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2871,7 +2905,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_retry_failed( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -2919,10 +2953,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2954,7 +2989,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_retrycanceled( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -3002,10 +3037,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py index 786c3c3bf6d7..07307061509a 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lro_retrys_operations.py @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def put201_creating_succeeded200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains @@ -84,10 +84,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -123,7 +124,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_relative_retry_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains @@ -172,10 +173,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -216,7 +218,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_provisioning202_accepted200_succeeded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains @@ -255,10 +257,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -304,7 +307,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete202_retry200( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns @@ -341,10 +344,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -375,7 +379,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_relative_retry_succeeded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the @@ -412,10 +416,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -447,7 +452,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post202_retry200( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls @@ -494,10 +499,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -528,7 +534,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_relative_retry_succeeded( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains @@ -576,10 +582,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py index a211b6975e70..335678d8e547 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/operations/lrosa_ds_operations.py @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def put_non_retry400( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 400 to the initial request @@ -81,10 +81,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -120,7 +121,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_non_retry201_creating400( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code @@ -167,10 +168,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -206,7 +208,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_non_retry201_creating400_invalid_json( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code @@ -253,10 +255,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -292,7 +295,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_relative_retry400( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -340,10 +343,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -384,7 +388,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_non_retry400( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 400 with an error body @@ -419,10 +423,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -453,7 +458,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete202_non_retry400( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 with a location header @@ -489,10 +494,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -523,7 +529,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_relative_retry400( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation @@ -560,10 +566,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -595,7 +602,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_non_retry400( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 400 with no error body @@ -640,10 +647,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -674,7 +682,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post202_non_retry400( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 with a location header @@ -719,10 +727,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -753,7 +762,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_relative_retry400( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation @@ -800,10 +809,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -835,7 +845,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_error201_no_provisioning_state_payload( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 201 to the initial request with no payload @@ -882,10 +892,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -921,7 +932,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_relative_retry_no_status( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -970,10 +981,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1014,7 +1026,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_relative_retry_no_status_payload( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -1063,10 +1075,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1107,7 +1120,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete204_succeeded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 204 to the initial request, indicating success. @@ -1143,10 +1156,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1173,7 +1187,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_relative_retry_no_status( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1210,10 +1224,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1245,7 +1260,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post202_no_location( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, without a location header. @@ -1291,10 +1306,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1325,7 +1341,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_relative_retry_no_payload( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -1373,10 +1389,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1408,7 +1425,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put200_invalid_json( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json @@ -1455,10 +1472,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1492,7 +1510,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_relative_retry_invalid_header( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -1540,10 +1558,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1584,7 +1603,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def put_async_relative_retry_invalid_json_polling( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -1633,10 +1652,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1677,7 +1697,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete202_retry_invalid_header( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and @@ -1714,10 +1734,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1748,7 +1769,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_relative_retry_invalid_header( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is @@ -1785,10 +1806,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1820,7 +1842,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete_async_relative_retry_invalid_json_polling( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation @@ -1857,10 +1879,11 @@ def long_running_send(): request = self._client.delete(url, query_parameters) return self._client.send(request, header_parameters, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1892,7 +1915,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post202_retry_invalid_header( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -1938,10 +1961,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -1972,7 +1996,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_relative_retry_invalid_header( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -2019,10 +2043,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -2054,7 +2079,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def post_async_relative_retry_invalid_json_polling( - self, product=None, custom_headers={}, raw=False, **operation_config): + self, product=None, custom_headers=None, raw=False, **operation_config): """ Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. @@ -2102,10 +2127,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/operations/paging_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/operations/paging_operations.py index a09052357a8f..d43a7e29ced3 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/operations/paging_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Paging/autorestpagingtestservice/operations/paging_operations.py @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_single_pages( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ A paging operation that finishes on the first call without a nextlink @@ -92,7 +92,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def get_multiple_pages( - self, client_request_id=None, paging_get_multiple_pages_options=None, custom_headers={}, raw=False, **operation_config): + self, client_request_id=None, paging_get_multiple_pages_options=None, custom_headers=None, raw=False, **operation_config): """ A paging operation that includes a nextLink that has 10 pages @@ -170,7 +170,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def get_multiple_pages_with_offset( - self, paging_get_multiple_pages_with_offset_options, client_request_id=None, custom_headers={}, raw=False, **operation_config): + self, paging_get_multiple_pages_with_offset_options, client_request_id=None, custom_headers=None, raw=False, **operation_config): """ A paging operation that includes a nextLink that has 10 pages @@ -255,7 +255,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def get_multiple_pages_retry_first( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ 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 @@ -314,7 +314,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def get_multiple_pages_retry_second( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ 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 @@ -374,7 +374,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def get_single_pages_failure( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ A paging operation that receives a 400 on the first call @@ -432,7 +432,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def get_multiple_pages_failure( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ A paging operation that receives a 400 on the second call @@ -490,7 +490,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def get_multiple_pages_failure_uri( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ A paging operation that receives an invalid nextLink diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py index 8d54b890d73f..d2583af6ef3d 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/storage_accounts_operations.py @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def check_name_availability( - self, account_name, custom_headers={}, raw=False, **operation_config): + self, account_name, custom_headers=None, raw=False, **operation_config): """ Checks that account name is valid and is not in use. @@ -102,7 +102,7 @@ def check_name_availability( return deserialized def create( - self, resource_group_name, account_name, parameters, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, account_name, parameters, custom_headers=None, raw=False, **operation_config): """ Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and @@ -164,10 +164,11 @@ def long_running_send(): return self._client.send( request, header_parameters, body_content, **operation_config) - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @@ -201,7 +202,7 @@ def get_long_running_output(response): get_long_running_status, long_running_operation_timeout) def delete( - self, resource_group_name, account_name, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): """ Deletes a storage account in Microsoft Azure. @@ -259,7 +260,7 @@ def delete( return client_raw_response def get_properties( - self, resource_group_name, account_name, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): """ Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The @@ -327,7 +328,7 @@ def get_properties( return deserialized def update( - self, resource_group_name, account_name, parameters, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, account_name, parameters, custom_headers=None, raw=False, **operation_config): """ 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 @@ -410,7 +411,7 @@ def update( return deserialized def list_keys( - self, resource_group_name, account_name, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): """ Lists the access keys for the specified storage account. @@ -472,7 +473,7 @@ def list_keys( return deserialized def list( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for @@ -537,7 +538,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def list_by_resource_group( - self, resource_group_name, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, custom_headers=None, raw=False, **operation_config): """ Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys @@ -606,7 +607,7 @@ def internal_paging(next_link=None, raw=False): return deserialized def regenerate_key( - self, resource_group_name, account_name, key_name=None, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, account_name, key_name=None, custom_headers=None, raw=False, **operation_config): """ Regenerates the access keys for the specified storage account. diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/usage_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/usage_operations.py index 80b0c0aca8a9..c4401f53ec53 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/usage_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/StorageManagementClient/storagemanagementclient/operations/usage_operations.py @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def list( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Gets the current usage count and the limit for the resources under the subscription. diff --git a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/operations/group_operations.py b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/operations/group_operations.py index 07c0bf0c8cbc..0ed768dc0f15 100644 --- a/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/operations/group_operations.py +++ b/AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/operations/group_operations.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_sample_resource_group( - self, resource_group_name, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, custom_headers=None, raw=False, **operation_config): """ Provides a resouce group with name 'testgroup101' and location 'West US'. diff --git a/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml b/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml index 78533cd45122..ed54f678d531 100644 --- a/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml +++ b/AutoRest/Generators/Python/Azure.Python/Templates/AzureLongRunningMethodTemplate.cshtml @@ -94,10 +94,11 @@ else @:return self._client.send(request, header_parameters, **operation_config) } @EmptyLine - def get_long_running_status(status_link, headers={}): + def get_long_running_status(status_link, headers=None): @EmptyLine request = self._client.get(status_link) - request.headers.update(headers) + if headers: + request.headers.update(headers) return self._client.send( request, header_parameters, **operation_config) @EmptyLine diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py index 51e2f30f7330..abed9ea1af30 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/autorestswaggerbatarrayservice/operations/array.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null array value @@ -76,7 +76,7 @@ def get_null( return deserialized def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid array [1, 2, 3 @@ -120,7 +120,7 @@ def get_invalid( return deserialized def get_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get empty array value [] @@ -164,7 +164,7 @@ def get_empty( return deserialized def put_empty( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value empty [] @@ -207,7 +207,7 @@ def put_empty( return client_raw_response def get_boolean_tfft( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean array value [true, false, false, true] @@ -251,7 +251,7 @@ def get_boolean_tfft( return deserialized def put_boolean_tfft( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value empty [true, false, false, true] @@ -294,7 +294,7 @@ def put_boolean_tfft( return client_raw_response def get_boolean_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean array value [true, null, false] @@ -338,7 +338,7 @@ def get_boolean_invalid_null( return deserialized def get_boolean_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean array value [true, 'boolean', false] @@ -382,7 +382,7 @@ def get_boolean_invalid_string( return deserialized def get_integer_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer array value [1, -1, 3, 300] @@ -426,7 +426,7 @@ def get_integer_valid( return deserialized def put_integer_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value empty [1, -1, 3, 300] @@ -469,7 +469,7 @@ def put_integer_valid( return client_raw_response def get_int_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer array value [1, null, 0] @@ -513,7 +513,7 @@ def get_int_invalid_null( return deserialized def get_int_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer array value [1, 'integer', 0] @@ -557,7 +557,7 @@ def get_int_invalid_string( return deserialized def get_long_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer array value [1, -1, 3, 300] @@ -601,7 +601,7 @@ def get_long_valid( return deserialized def put_long_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value empty [1, -1, 3, 300] @@ -644,7 +644,7 @@ def put_long_valid( return client_raw_response def get_long_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get long array value [1, null, 0] @@ -688,7 +688,7 @@ def get_long_invalid_null( return deserialized def get_long_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get long array value [1, 'integer', 0] @@ -732,7 +732,7 @@ def get_long_invalid_string( return deserialized def get_float_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get float array value [0, -0.01, 1.2e20] @@ -776,7 +776,7 @@ def get_float_valid( return deserialized def put_float_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value [0, -0.01, 1.2e20] @@ -819,7 +819,7 @@ def put_float_valid( return client_raw_response def get_float_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get float array value [0.0, null, -1.2e20] @@ -863,7 +863,7 @@ def get_float_invalid_null( return deserialized def get_float_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean array value [1.0, 'number', 0.0] @@ -907,7 +907,7 @@ def get_float_invalid_string( return deserialized def get_double_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get float array value [0, -0.01, 1.2e20] @@ -951,7 +951,7 @@ def get_double_valid( return deserialized def put_double_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value [0, -0.01, 1.2e20] @@ -994,7 +994,7 @@ def put_double_valid( return client_raw_response def get_double_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get float array value [0.0, null, -1.2e20] @@ -1038,7 +1038,7 @@ def get_double_invalid_null( return deserialized def get_double_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean array value [1.0, 'number', 0.0] @@ -1082,7 +1082,7 @@ def get_double_invalid_string( return deserialized def get_string_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get string array value ['foo1', 'foo2', 'foo3'] @@ -1126,7 +1126,7 @@ def get_string_valid( return deserialized def put_string_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value ['foo1', 'foo2', 'foo3'] @@ -1169,7 +1169,7 @@ def put_string_valid( return client_raw_response def get_string_with_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get string array value ['foo', null, 'foo2'] @@ -1213,7 +1213,7 @@ def get_string_with_null( return deserialized def get_string_with_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get string array value ['foo', 123, 'foo2'] @@ -1257,7 +1257,7 @@ def get_string_with_invalid( return deserialized def get_uuid_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', @@ -1303,7 +1303,7 @@ def get_uuid_valid( return deserialized def put_uuid_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', @@ -1348,7 +1348,7 @@ def put_uuid_valid( return client_raw_response def get_uuid_invalid_chars( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo'] @@ -1392,7 +1392,7 @@ def get_uuid_invalid_chars( return deserialized def get_date_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12'] @@ -1436,7 +1436,7 @@ def get_date_valid( return deserialized def put_date_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value ['2000-12-01', '1980-01-02', '1492-10-12'] @@ -1479,7 +1479,7 @@ def put_date_valid( return client_raw_response def get_date_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date array value ['2012-01-01', null, '1776-07-04'] @@ -1523,7 +1523,7 @@ def get_date_invalid_null( return deserialized def get_date_invalid_chars( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date array value ['2011-03-22', 'date'] @@ -1567,7 +1567,7 @@ def get_date_invalid_chars( return deserialized def get_date_time_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00'] @@ -1612,7 +1612,7 @@ def get_date_time_valid( return deserialized def put_date_time_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00'] @@ -1656,7 +1656,7 @@ def put_date_time_valid( return client_raw_response def get_date_time_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date array value ['2000-12-01t00:00:01z', null] @@ -1700,7 +1700,7 @@ def get_date_time_invalid_null( return deserialized def get_date_time_invalid_chars( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date array value ['2000-12-01t00:00:01z', 'date-time'] @@ -1744,7 +1744,7 @@ def get_date_time_invalid_chars( return deserialized def get_date_time_rfc1123_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ 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'] @@ -1789,7 +1789,7 @@ def get_date_time_rfc1123_valid( return deserialized def put_date_time_rfc1123_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ 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'] @@ -1833,7 +1833,7 @@ def put_date_time_rfc1123_valid( return client_raw_response def get_duration_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S'] @@ -1877,7 +1877,7 @@ def get_duration_valid( return deserialized def put_duration_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S'] @@ -1920,7 +1920,7 @@ def put_duration_valid( return client_raw_response def get_byte_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64 @@ -1965,7 +1965,7 @@ def get_byte_valid( return deserialized def put_byte_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64 @@ -2009,7 +2009,7 @@ def put_byte_valid( return client_raw_response def get_byte_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded @@ -2054,7 +2054,7 @@ def get_byte_invalid_null( return deserialized def get_base64_url( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded @@ -2099,7 +2099,7 @@ def get_base64_url( return deserialized def get_complex_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get array of complex type null value @@ -2144,7 +2144,7 @@ def get_complex_null( return deserialized def get_complex_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get empty array of complex type [] @@ -2189,7 +2189,7 @@ def get_complex_empty( return deserialized def get_complex_item_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}] @@ -2235,7 +2235,7 @@ def get_complex_item_null( return deserialized def get_complex_item_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}] @@ -2281,7 +2281,7 @@ def get_complex_item_empty( return deserialized def get_complex_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}] @@ -2327,7 +2327,7 @@ def get_complex_valid( return deserialized def put_complex_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}] @@ -2372,7 +2372,7 @@ def put_complex_valid( return client_raw_response def get_array_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a null array @@ -2416,7 +2416,7 @@ def get_array_null( return deserialized def get_array_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an empty array [] @@ -2460,7 +2460,7 @@ def get_array_empty( return deserialized def get_array_item_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']] @@ -2505,7 +2505,7 @@ def get_array_item_null( return deserialized def get_array_item_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']] @@ -2549,7 +2549,7 @@ def get_array_item_empty( return deserialized def get_array_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] @@ -2594,7 +2594,7 @@ def get_array_valid( return deserialized def put_array_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] @@ -2638,7 +2638,7 @@ def put_array_valid( return client_raw_response def get_dictionary_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of Dictionaries with value null @@ -2682,7 +2682,7 @@ def get_dictionary_null( return deserialized def get_dictionary_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of Dictionaries of type with value [] @@ -2726,7 +2726,7 @@ def get_dictionary_empty( return deserialized def get_dictionary_item_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': @@ -2772,7 +2772,7 @@ def get_dictionary_item_null( return deserialized def get_dictionary_item_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': @@ -2818,7 +2818,7 @@ def get_dictionary_item_empty( return deserialized def get_dictionary_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', @@ -2864,7 +2864,7 @@ def get_dictionary_valid( return deserialized def put_dictionary_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/operations/bool_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/operations/bool_model.py index 0ec9dc24c7a6..7476481a89bb 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/operations/bool_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/operations/bool_model.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_true( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get true Boolean value @@ -76,7 +76,7 @@ def get_true( return deserialized def put_true( - self, bool_body, custom_headers={}, raw=False, **operation_config): + self, bool_body, custom_headers=None, raw=False, **operation_config): """ Set Boolean value true @@ -119,7 +119,7 @@ def put_true( return client_raw_response def get_false( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get false Boolean value @@ -163,7 +163,7 @@ def get_false( return deserialized def put_false( - self, bool_body, custom_headers={}, raw=False, **operation_config): + self, bool_body, custom_headers=None, raw=False, **operation_config): """ Set Boolean value false @@ -206,7 +206,7 @@ def put_false( return client_raw_response def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null Boolean value @@ -250,7 +250,7 @@ def get_null( return deserialized def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid Boolean value diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/operations/byte.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/operations/byte.py index f879f85351a0..4c616117291b 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/operations/byte.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyByte/autorestswaggerbatbyteservice/operations/byte.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null byte value @@ -76,7 +76,7 @@ def get_null( return deserialized def get_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get empty byte value '' @@ -120,7 +120,7 @@ def get_empty( return deserialized def get_non_ascii( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6) @@ -164,7 +164,7 @@ def get_non_ascii( return deserialized def put_non_ascii( - self, byte_body, custom_headers={}, raw=False, **operation_config): + self, byte_body, custom_headers=None, raw=False, **operation_config): """ Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6) @@ -208,7 +208,7 @@ def put_non_ascii( return client_raw_response def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid byte value ':::SWAGGER::::' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py index e375d28d5b3a..3fb6eec8be8f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/array.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with array property @@ -77,7 +77,7 @@ def get_valid( return deserialized def put_valid( - self, array=None, custom_headers={}, raw=False, **operation_config): + self, array=None, custom_headers=None, raw=False, **operation_config): """ Put complex types with array property @@ -122,7 +122,7 @@ def put_valid( return client_raw_response def get_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with array property which is empty @@ -167,7 +167,7 @@ def get_empty( return deserialized def put_empty( - self, array=None, custom_headers={}, raw=False, **operation_config): + self, array=None, custom_headers=None, raw=False, **operation_config): """ Put complex types with array property which is empty @@ -212,7 +212,7 @@ def put_empty( return client_raw_response def get_not_provided( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with array property while server doesn't provide a response payload diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py index f1cf4be957c2..d66a86b411e3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/basic_operations.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex type {id: 2, name: 'abc', color: 'YELLOW'} @@ -77,7 +77,7 @@ def get_valid( return deserialized def put_valid( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Please put {id: 2, name: 'abc', color: 'Magenta'} @@ -122,7 +122,7 @@ def put_valid( return client_raw_response def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a basic complex type that is invalid for the local strong type @@ -167,7 +167,7 @@ def get_invalid( return deserialized def get_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a basic complex type that is empty @@ -212,7 +212,7 @@ def get_empty( return deserialized def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a basic complex type whose properties are null @@ -257,7 +257,7 @@ def get_null( return deserialized def get_not_provided( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a basic complex type while the server doesn't provide a response payload diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py index c99f68238ac6..cc07b65e49e0 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/dictionary.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with dictionary property @@ -77,7 +77,7 @@ def get_valid( return deserialized def put_valid( - self, default_program=None, custom_headers={}, raw=False, **operation_config): + self, default_program=None, custom_headers=None, raw=False, **operation_config): """ Put complex types with dictionary property @@ -122,7 +122,7 @@ def put_valid( return client_raw_response def get_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with dictionary property which is empty @@ -167,7 +167,7 @@ def get_empty( return deserialized def put_empty( - self, default_program=None, custom_headers={}, raw=False, **operation_config): + self, default_program=None, custom_headers=None, raw=False, **operation_config): """ Put complex types with dictionary property which is empty @@ -212,7 +212,7 @@ def put_empty( return client_raw_response def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with dictionary property which is null @@ -257,7 +257,7 @@ def get_null( return deserialized def get_not_provided( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with dictionary property while server doesn't provide a response payload diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py index 94062da6c3bf..37bf308be2fd 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/inheritance.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types that extend others @@ -77,7 +77,7 @@ def get_valid( return deserialized def put_valid( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types that extend others diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py index d2aadc47ad3a..451955b6fee2 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphicrecursive.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types that are polymorphic and have recursive references @@ -77,7 +77,7 @@ def get_valid( return deserialized def put_valid( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types that are polymorphic and have recursive references diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py index 3b3d75f90dfb..e85c471abf09 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/polymorphism.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types that are polymorphic @@ -77,7 +77,7 @@ def get_valid( return deserialized def put_valid( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types that are polymorphic @@ -154,7 +154,7 @@ def put_valid( return client_raw_response def put_valid_missing_required( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py index de0386c4de16..ca9e56f8d0b0 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/primitive.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_int( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with integer properties @@ -77,7 +77,7 @@ def get_int( return deserialized def put_int( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with integer properties @@ -121,7 +121,7 @@ def put_int( return client_raw_response def get_long( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with long properties @@ -166,7 +166,7 @@ def get_long( return deserialized def put_long( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with long properties @@ -210,7 +210,7 @@ def put_long( return client_raw_response def get_float( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with float properties @@ -255,7 +255,7 @@ def get_float( return deserialized def put_float( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with float properties @@ -299,7 +299,7 @@ def put_float( return client_raw_response def get_double( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with double properties @@ -344,7 +344,7 @@ def get_double( return deserialized def put_double( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with double properties @@ -389,7 +389,7 @@ def put_double( return client_raw_response def get_bool( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with bool properties @@ -434,7 +434,7 @@ def get_bool( return deserialized def put_bool( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with bool properties @@ -478,7 +478,7 @@ def put_bool( return client_raw_response def get_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with string properties @@ -523,7 +523,7 @@ def get_string( return deserialized def put_string( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with string properties @@ -567,7 +567,7 @@ def put_string( return client_raw_response def get_date( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with date properties @@ -612,7 +612,7 @@ def get_date( return deserialized def put_date( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with date properties @@ -656,7 +656,7 @@ def put_date( return client_raw_response def get_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with datetime properties @@ -701,7 +701,7 @@ def get_date_time( return deserialized def put_date_time( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with datetime properties @@ -746,7 +746,7 @@ def put_date_time( return client_raw_response def get_date_time_rfc1123( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with datetimeRfc1123 properties @@ -791,7 +791,7 @@ def get_date_time_rfc1123( return deserialized def put_date_time_rfc1123( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types with datetimeRfc1123 properties @@ -836,7 +836,7 @@ def put_date_time_rfc1123( return client_raw_response def get_duration( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with duration properties @@ -881,7 +881,7 @@ def get_duration( return deserialized def put_duration( - self, field=None, custom_headers={}, raw=False, **operation_config): + self, field=None, custom_headers=None, raw=False, **operation_config): """ Put complex types with duration properties @@ -926,7 +926,7 @@ def put_duration( return client_raw_response def get_byte( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types with byte properties @@ -971,7 +971,7 @@ def get_byte( return deserialized def put_byte( - self, field=None, custom_headers={}, raw=False, **operation_config): + self, field=None, custom_headers=None, raw=False, **operation_config): """ Put complex types with byte properties diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py index fde563ffc3a2..d8505c972da6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/operations/readonlyproperty.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get complex types that have readonly properties @@ -77,7 +77,7 @@ def get_valid( return deserialized def put_valid( - self, complex_body, custom_headers={}, raw=False, **operation_config): + self, complex_body, custom_headers=None, raw=False, **operation_config): """ Put complex types that have readonly properties diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/operations/date_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/operations/date_model.py index c0b1f47c71e0..4f0f9e778d42 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/operations/date_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDate/autorestdatetestservice/operations/date_model.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null date value @@ -76,7 +76,7 @@ def get_null( return deserialized def get_invalid_date( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid date value @@ -120,7 +120,7 @@ def get_invalid_date( return deserialized def get_overflow_date( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get overflow date value @@ -164,7 +164,7 @@ def get_overflow_date( return deserialized def get_underflow_date( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get underflow date value @@ -208,7 +208,7 @@ def get_underflow_date( return deserialized def put_max_date( - self, date_body, custom_headers={}, raw=False, **operation_config): + self, date_body, custom_headers=None, raw=False, **operation_config): """ Put max date value 9999-12-31 @@ -251,7 +251,7 @@ def put_max_date( return client_raw_response def get_max_date( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max date value 9999-12-31 @@ -295,7 +295,7 @@ def get_max_date( return deserialized def put_min_date( - self, date_body, custom_headers={}, raw=False, **operation_config): + self, date_body, custom_headers=None, raw=False, **operation_config): """ Put min date value 0000-01-01 @@ -338,7 +338,7 @@ def put_min_date( return client_raw_response def get_min_date( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get min date value 0000-01-01 diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/operations/datetime_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/operations/datetime_model.py index 36fe8312b4a8..b4412d87ef4a 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/operations/datetime_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTime/autorestdatetimetestservice/operations/datetime_model.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null datetime value @@ -76,7 +76,7 @@ def get_null( return deserialized def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid datetime value @@ -120,7 +120,7 @@ def get_invalid( return deserialized def get_overflow( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get overflow datetime value @@ -164,7 +164,7 @@ def get_overflow( return deserialized def get_underflow( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get underflow datetime value @@ -208,7 +208,7 @@ def get_underflow( return deserialized def put_utc_max_date_time( - self, datetime_body, custom_headers={}, raw=False, **operation_config): + self, datetime_body, custom_headers=None, raw=False, **operation_config): """ Put max datetime value 9999-12-31T23:59:59.9999999Z @@ -251,7 +251,7 @@ def put_utc_max_date_time( return client_raw_response def get_utc_lowercase_max_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max datetime value 9999-12-31t23:59:59.9999999z @@ -295,7 +295,7 @@ def get_utc_lowercase_max_date_time( return deserialized def get_utc_uppercase_max_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max datetime value 9999-12-31T23:59:59.9999999Z @@ -339,7 +339,7 @@ def get_utc_uppercase_max_date_time( return deserialized def put_local_positive_offset_max_date_time( - self, datetime_body, custom_headers={}, raw=False, **operation_config): + self, datetime_body, custom_headers=None, raw=False, **operation_config): """ Put max datetime value with positive numoffset 9999-12-31t23:59:59.9999999+14:00 @@ -383,7 +383,7 @@ def put_local_positive_offset_max_date_time( return client_raw_response def get_local_positive_offset_lowercase_max_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max datetime value with positive num offset 9999-12-31t23:59:59.9999999+14:00 @@ -428,7 +428,7 @@ def get_local_positive_offset_lowercase_max_date_time( return deserialized def get_local_positive_offset_uppercase_max_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max datetime value with positive num offset 9999-12-31T23:59:59.9999999+14:00 @@ -473,7 +473,7 @@ def get_local_positive_offset_uppercase_max_date_time( return deserialized def put_local_negative_offset_max_date_time( - self, datetime_body, custom_headers={}, raw=False, **operation_config): + self, datetime_body, custom_headers=None, raw=False, **operation_config): """ Put max datetime value with positive numoffset 9999-12-31t23:59:59.9999999-14:00 @@ -517,7 +517,7 @@ def put_local_negative_offset_max_date_time( return client_raw_response def get_local_negative_offset_uppercase_max_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max datetime value with positive num offset 9999-12-31T23:59:59.9999999-14:00 @@ -562,7 +562,7 @@ def get_local_negative_offset_uppercase_max_date_time( return deserialized def get_local_negative_offset_lowercase_max_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max datetime value with positive num offset 9999-12-31t23:59:59.9999999-14:00 @@ -607,7 +607,7 @@ def get_local_negative_offset_lowercase_max_date_time( return deserialized def put_utc_min_date_time( - self, datetime_body, custom_headers={}, raw=False, **operation_config): + self, datetime_body, custom_headers=None, raw=False, **operation_config): """ Put min datetime value 0001-01-01T00:00:00Z @@ -650,7 +650,7 @@ def put_utc_min_date_time( return client_raw_response def get_utc_min_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get min datetime value 0001-01-01T00:00:00Z @@ -694,7 +694,7 @@ def get_utc_min_date_time( return deserialized def put_local_positive_offset_min_date_time( - self, datetime_body, custom_headers={}, raw=False, **operation_config): + self, datetime_body, custom_headers=None, raw=False, **operation_config): """ Put min datetime value 0001-01-01T00:00:00+14:00 @@ -737,7 +737,7 @@ def put_local_positive_offset_min_date_time( return client_raw_response def get_local_positive_offset_min_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get min datetime value 0001-01-01T00:00:00+14:00 @@ -781,7 +781,7 @@ def get_local_positive_offset_min_date_time( return deserialized def put_local_negative_offset_min_date_time( - self, datetime_body, custom_headers={}, raw=False, **operation_config): + self, datetime_body, custom_headers=None, raw=False, **operation_config): """ Put min datetime value 0001-01-01T00:00:00-14:00 @@ -824,7 +824,7 @@ def put_local_negative_offset_min_date_time( return client_raw_response def get_local_negative_offset_min_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get min datetime value 0001-01-01T00:00:00-14:00 diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/operations/datetimerfc1123.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/operations/datetimerfc1123.py index 679bb0be6bc1..1d9e03f21416 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/operations/datetimerfc1123.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDateTimeRfc1123/autorestrfc1123datetimetestservice/operations/datetimerfc1123.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null datetime value @@ -76,7 +76,7 @@ def get_null( return deserialized def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid datetime value @@ -120,7 +120,7 @@ def get_invalid( return deserialized def get_overflow( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get overflow datetime value @@ -164,7 +164,7 @@ def get_overflow( return deserialized def get_underflow( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get underflow datetime value @@ -208,7 +208,7 @@ def get_underflow( return deserialized def put_utc_max_date_time( - self, datetime_body, custom_headers={}, raw=False, **operation_config): + self, datetime_body, custom_headers=None, raw=False, **operation_config): """ Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT @@ -251,7 +251,7 @@ def put_utc_max_date_time( return client_raw_response def get_utc_lowercase_max_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max datetime value fri, 31 dec 9999 23:59:59 gmt @@ -295,7 +295,7 @@ def get_utc_lowercase_max_date_time( return deserialized def get_utc_uppercase_max_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT @@ -339,7 +339,7 @@ def get_utc_uppercase_max_date_time( return deserialized def put_utc_min_date_time( - self, datetime_body, custom_headers={}, raw=False, **operation_config): + self, datetime_body, custom_headers=None, raw=False, **operation_config): """ Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT @@ -382,7 +382,7 @@ def put_utc_min_date_time( return client_raw_response def get_utc_min_date_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/operations/dictionary.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/operations/dictionary.py index ef93fea23fd6..5744c23adfac 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/operations/dictionary.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDictionary/autorestswaggerbatdictionaryservice/operations/dictionary.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null dictionary value @@ -76,7 +76,7 @@ def get_null( return deserialized def get_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get empty dictionary value {} @@ -120,7 +120,7 @@ def get_empty( return deserialized def put_empty( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value empty {} @@ -163,7 +163,7 @@ def put_empty( return client_raw_response def get_null_value( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get Dictionary with null value @@ -207,7 +207,7 @@ def get_null_value( return deserialized def get_null_key( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get Dictionary with null key @@ -251,7 +251,7 @@ def get_null_key( return deserialized def get_empty_string_key( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get Dictionary with key as empty string @@ -295,7 +295,7 @@ def get_empty_string_key( return deserialized def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid Dictionary value @@ -339,7 +339,7 @@ def get_invalid( return deserialized def get_boolean_tfft( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true } @@ -384,7 +384,7 @@ def get_boolean_tfft( return deserialized def put_boolean_tfft( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value empty {"0": true, "1": false, "2": false, "3": true } @@ -428,7 +428,7 @@ def put_boolean_tfft( return client_raw_response def get_boolean_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean dictionary value {"0": true, "1": null, "2": false } @@ -472,7 +472,7 @@ def get_boolean_invalid_null( return deserialized def get_boolean_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}' @@ -516,7 +516,7 @@ def get_boolean_invalid_string( return deserialized def get_integer_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300} @@ -560,7 +560,7 @@ def get_integer_valid( return deserialized def put_integer_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300} @@ -603,7 +603,7 @@ def put_integer_valid( return client_raw_response def get_int_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer dictionary value {"0": 1, "1": null, "2": 0} @@ -647,7 +647,7 @@ def get_int_invalid_null( return deserialized def get_int_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer dictionary value {"0": 1, "1": "integer", "2": 0} @@ -691,7 +691,7 @@ def get_int_invalid_string( return deserialized def get_long_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300} @@ -735,7 +735,7 @@ def get_long_valid( return deserialized def put_long_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300} @@ -778,7 +778,7 @@ def put_long_valid( return client_raw_response def get_long_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get long dictionary value {"0": 1, "1": null, "2": 0} @@ -822,7 +822,7 @@ def get_long_invalid_null( return deserialized def get_long_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get long dictionary value {"0": 1, "1": "integer", "2": 0} @@ -866,7 +866,7 @@ def get_long_invalid_string( return deserialized def get_float_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} @@ -910,7 +910,7 @@ def get_float_valid( return deserialized def put_float_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} @@ -953,7 +953,7 @@ def put_float_valid( return client_raw_response def get_float_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20} @@ -997,7 +997,7 @@ def get_float_invalid_null( return deserialized def get_float_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0} @@ -1041,7 +1041,7 @@ def get_float_invalid_string( return deserialized def get_double_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} @@ -1085,7 +1085,7 @@ def get_double_valid( return deserialized def put_double_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} @@ -1128,7 +1128,7 @@ def put_double_valid( return client_raw_response def get_double_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20} @@ -1172,7 +1172,7 @@ def get_double_invalid_null( return deserialized def get_double_invalid_string( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0} @@ -1216,7 +1216,7 @@ def get_double_invalid_string( return deserialized def get_string_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"} @@ -1260,7 +1260,7 @@ def get_string_valid( return deserialized def put_string_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"} @@ -1303,7 +1303,7 @@ def put_string_valid( return client_raw_response def get_string_with_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get string dictionary value {"0": "foo", "1": null, "2": "foo2"} @@ -1347,7 +1347,7 @@ def get_string_with_null( return deserialized def get_string_with_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"} @@ -1391,7 +1391,7 @@ def get_string_with_invalid( return deserialized def get_date_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"} @@ -1436,7 +1436,7 @@ def get_date_valid( return deserialized def put_date_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"} @@ -1480,7 +1480,7 @@ def put_date_valid( return client_raw_response def get_date_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"} @@ -1525,7 +1525,7 @@ def get_date_invalid_null( return deserialized def get_date_invalid_chars( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date dictionary value {"0": "2011-03-22", "1": "date"} @@ -1569,7 +1569,7 @@ def get_date_invalid_chars( return deserialized def get_date_time_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ 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"} @@ -1614,7 +1614,7 @@ def get_date_time_valid( return deserialized def put_date_time_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ 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"} @@ -1658,7 +1658,7 @@ def put_date_time_valid( return client_raw_response def get_date_time_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null} @@ -1702,7 +1702,7 @@ def get_date_time_invalid_null( return deserialized def get_date_time_invalid_chars( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"} @@ -1747,7 +1747,7 @@ def get_date_time_invalid_chars( return deserialized def get_date_time_rfc1123_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ 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 @@ -1793,7 +1793,7 @@ def get_date_time_rfc1123_valid( return deserialized def put_date_time_rfc1123_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ 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"} @@ -1837,7 +1837,7 @@ def put_date_time_rfc1123_valid( return client_raw_response def get_duration_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"} @@ -1882,7 +1882,7 @@ def get_duration_valid( return deserialized def put_duration_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"} @@ -1925,7 +1925,7 @@ def put_duration_valid( return client_raw_response def get_byte_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ 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 @@ -1970,7 +1970,7 @@ def get_byte_valid( return deserialized def put_byte_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ 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 @@ -2014,7 +2014,7 @@ def put_byte_valid( return client_raw_response def get_byte_invalid_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 encoded @@ -2059,7 +2059,7 @@ def get_byte_invalid_null( return deserialized def get_base64_url( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get base64url dictionary value {"0": "a string that gets encoded with base64url", "1": "test string", "2": "Lorem ipsum"} @@ -2104,7 +2104,7 @@ def get_base64_url( return deserialized def get_complex_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get dictionary of complex type null value @@ -2148,7 +2148,7 @@ def get_complex_null( return deserialized def get_complex_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get empty dictionary of complex type {} @@ -2192,7 +2192,7 @@ def get_complex_empty( return deserialized def get_complex_item_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}} @@ -2237,7 +2237,7 @@ def get_complex_item_null( return deserialized def get_complex_item_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}} @@ -2282,7 +2282,7 @@ def get_complex_item_empty( return deserialized def get_complex_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, @@ -2328,7 +2328,7 @@ def get_complex_valid( return deserialized def put_complex_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": @@ -2373,7 +2373,7 @@ def put_complex_valid( return client_raw_response def get_array_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a null array @@ -2417,7 +2417,7 @@ def get_array_null( return deserialized def get_array_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an empty dictionary {} @@ -2461,7 +2461,7 @@ def get_array_empty( return deserialized def get_array_item_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]} @@ -2506,7 +2506,7 @@ def get_array_item_null( return deserialized def get_array_item_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]} @@ -2551,7 +2551,7 @@ def get_array_item_empty( return deserialized def get_array_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]} @@ -2596,7 +2596,7 @@ def get_array_valid( return deserialized def put_array_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]} @@ -2640,7 +2640,7 @@ def put_array_valid( return client_raw_response def get_dictionary_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an dictionaries of dictionaries with value null @@ -2684,7 +2684,7 @@ def get_dictionary_null( return deserialized def get_dictionary_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an dictionaries of dictionaries of type with value {} @@ -2729,7 +2729,7 @@ def get_dictionary_empty( return deserialized def get_dictionary_item_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": @@ -2775,7 +2775,7 @@ def get_dictionary_item_null( return deserialized def get_dictionary_item_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": @@ -2821,7 +2821,7 @@ def get_dictionary_item_empty( return deserialized def get_dictionary_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": @@ -2868,7 +2868,7 @@ def get_dictionary_valid( return deserialized def put_dictionary_valid( - self, array_body, custom_headers={}, raw=False, **operation_config): + self, array_body, custom_headers=None, raw=False, **operation_config): """ Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/operations/duration.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/operations/duration.py index d99043d42dc1..1bf3b5a41663 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/operations/duration.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyDuration/autorestdurationtestservice/operations/duration.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null duration value @@ -76,7 +76,7 @@ def get_null( return deserialized def put_positive_duration( - self, duration_body, custom_headers={}, raw=False, **operation_config): + self, duration_body, custom_headers=None, raw=False, **operation_config): """ Put a positive duration value @@ -119,7 +119,7 @@ def put_positive_duration( return client_raw_response def get_positive_duration( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a positive duration value @@ -163,7 +163,7 @@ def get_positive_duration( return deserialized def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get an invalid duration value diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/operations/files.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/operations/files.py index d471df199e94..82b953c456f7 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/operations/files.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFile/autorestswaggerbatfileservice/operations/files.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_file( - self, custom_headers={}, raw=False, callback=None, **operation_config): + self, custom_headers=None, raw=False, callback=None, **operation_config): """ Get file @@ -81,7 +81,7 @@ def get_file( return deserialized def get_file_large( - self, custom_headers={}, raw=False, callback=None, **operation_config): + self, custom_headers=None, raw=False, callback=None, **operation_config): """ Get a large file @@ -130,7 +130,7 @@ def get_file_large( return deserialized def get_empty_file( - self, custom_headers={}, raw=False, callback=None, **operation_config): + self, custom_headers=None, raw=False, callback=None, **operation_config): """ Get empty file diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/operations/formdata.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/operations/formdata.py index ed3621ac98a0..99b61bb72e94 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/operations/formdata.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/operations/formdata.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def upload_file( - self, file_content, file_name, custom_headers={}, raw=False, callback=None, **operation_config): + self, file_content, file_name, custom_headers=None, raw=False, callback=None, **operation_config): """ Upload file @@ -93,7 +93,7 @@ def upload_file( return deserialized def upload_file_via_body( - self, file_content, custom_headers={}, raw=False, callback=None, **operation_config): + self, file_content, custom_headers=None, raw=False, callback=None, **operation_config): """ Upload file diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/operations/int_model.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/operations/int_model.py index 8474f7d5cdf3..a0140cff75d0 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/operations/int_model.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyInteger/autorestintegertestservice/operations/int_model.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null Int value @@ -76,7 +76,7 @@ def get_null( return deserialized def get_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid Int value @@ -120,7 +120,7 @@ def get_invalid( return deserialized def get_overflow_int32( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get overflow Int32 value @@ -164,7 +164,7 @@ def get_overflow_int32( return deserialized def get_underflow_int32( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get underflow Int32 value @@ -208,7 +208,7 @@ def get_underflow_int32( return deserialized def get_overflow_int64( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get overflow Int64 value @@ -252,7 +252,7 @@ def get_overflow_int64( return deserialized def get_underflow_int64( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get underflow Int64 value @@ -296,7 +296,7 @@ def get_underflow_int64( return deserialized def put_max32( - self, int_body, custom_headers={}, raw=False, **operation_config): + self, int_body, custom_headers=None, raw=False, **operation_config): """ Put max int32 value @@ -339,7 +339,7 @@ def put_max32( return client_raw_response def put_max64( - self, int_body, custom_headers={}, raw=False, **operation_config): + self, int_body, custom_headers=None, raw=False, **operation_config): """ Put max int64 value @@ -382,7 +382,7 @@ def put_max64( return client_raw_response def put_min32( - self, int_body, custom_headers={}, raw=False, **operation_config): + self, int_body, custom_headers=None, raw=False, **operation_config): """ Put min int32 value @@ -425,7 +425,7 @@ def put_min32( return client_raw_response def put_min64( - self, int_body, custom_headers={}, raw=False, **operation_config): + self, int_body, custom_headers=None, raw=False, **operation_config): """ Put min int64 value @@ -468,7 +468,7 @@ def put_min64( return client_raw_response def get_unix_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get datetime encoded as Unix time value @@ -512,7 +512,7 @@ def get_unix_time( return deserialized def put_unix_time_date( - self, int_body, custom_headers={}, raw=False, **operation_config): + self, int_body, custom_headers=None, raw=False, **operation_config): """ Put datetime encoded as Unix time @@ -555,7 +555,7 @@ def put_unix_time_date( return client_raw_response def get_invalid_unix_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid Unix time value @@ -599,7 +599,7 @@ def get_invalid_unix_time( return deserialized def get_null_unix_time( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null Unix time value diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/operations/number.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/operations/number.py index bfc4e6c78c82..407caf307595 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/operations/number.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyNumber/autorestnumbertestservice/operations/number.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null Number value @@ -76,7 +76,7 @@ def get_null( return deserialized def get_invalid_float( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid float Number value @@ -120,7 +120,7 @@ def get_invalid_float( return deserialized def get_invalid_double( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid double Number value @@ -164,7 +164,7 @@ def get_invalid_double( return deserialized def get_invalid_decimal( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get invalid decimal Number value @@ -208,7 +208,7 @@ def get_invalid_decimal( return deserialized def put_big_float( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put big float value 3.402823e+20 @@ -251,7 +251,7 @@ def put_big_float( return client_raw_response def get_big_float( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big float value 3.402823e+20 @@ -295,7 +295,7 @@ def get_big_float( return deserialized def put_big_double( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put big double value 2.5976931e+101 @@ -338,7 +338,7 @@ def put_big_double( return client_raw_response def get_big_double( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big double value 2.5976931e+101 @@ -382,7 +382,7 @@ def get_big_double( return deserialized def put_big_double_positive_decimal( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put big double value 99999999.99 @@ -425,7 +425,7 @@ def put_big_double_positive_decimal( return client_raw_response def get_big_double_positive_decimal( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big double value 99999999.99 @@ -469,7 +469,7 @@ def get_big_double_positive_decimal( return deserialized def put_big_double_negative_decimal( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put big double value -99999999.99 @@ -512,7 +512,7 @@ def put_big_double_negative_decimal( return client_raw_response def get_big_double_negative_decimal( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big double value -99999999.99 @@ -556,7 +556,7 @@ def get_big_double_negative_decimal( return deserialized def put_big_decimal( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put big decimal value 2.5976931e+101 @@ -599,7 +599,7 @@ def put_big_decimal( return client_raw_response def get_big_decimal( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big decimal value 2.5976931e+101 @@ -643,7 +643,7 @@ def get_big_decimal( return deserialized def put_big_decimal_positive_decimal( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put big decimal value 99999999.99 @@ -686,7 +686,7 @@ def put_big_decimal_positive_decimal( return client_raw_response def get_big_decimal_positive_decimal( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big decimal value 99999999.99 @@ -730,7 +730,7 @@ def get_big_decimal_positive_decimal( return deserialized def put_big_decimal_negative_decimal( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put big decimal value -99999999.99 @@ -773,7 +773,7 @@ def put_big_decimal_negative_decimal( return client_raw_response def get_big_decimal_negative_decimal( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big decimal value -99999999.99 @@ -817,7 +817,7 @@ def get_big_decimal_negative_decimal( return deserialized def put_small_float( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put small float value 3.402823e-20 @@ -860,7 +860,7 @@ def put_small_float( return client_raw_response def get_small_float( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big double value 3.402823e-20 @@ -904,7 +904,7 @@ def get_small_float( return deserialized def put_small_double( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put small double value 2.5976931e-101 @@ -947,7 +947,7 @@ def put_small_double( return client_raw_response def get_small_double( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get big double value 2.5976931e-101 @@ -991,7 +991,7 @@ def get_small_double( return deserialized def put_small_decimal( - self, number_body, custom_headers={}, raw=False, **operation_config): + self, number_body, custom_headers=None, raw=False, **operation_config): """ Put small decimal value 2.5976931e-101 @@ -1034,7 +1034,7 @@ def put_small_decimal( return client_raw_response def get_small_decimal( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get small decimal value 2.5976931e-101 diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/enum.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/enum.py index 18169ce12b9c..9880ab28e091 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/enum.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/enum.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_not_expandable( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. @@ -77,7 +77,7 @@ def get_not_expandable( return deserialized def put_not_expandable( - self, string_body, custom_headers={}, raw=False, **operation_config): + self, string_body, custom_headers=None, raw=False, **operation_config): """ Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color' diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py index c6a765bba296..09a976276385 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyString/autorestswaggerbatservice/operations/string.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_null( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null string value value @@ -76,7 +76,7 @@ def get_null( return deserialized def put_null( - self, string_body=None, custom_headers={}, raw=False, **operation_config): + self, string_body=None, custom_headers=None, raw=False, **operation_config): """ Set string value null @@ -122,7 +122,7 @@ def put_null( return client_raw_response def get_empty( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get empty string value value '' @@ -166,7 +166,7 @@ def get_empty( return deserialized def put_empty( - self, string_body, custom_headers={}, raw=False, **operation_config): + self, string_body, custom_headers=None, raw=False, **operation_config): """ Set string value empty '' @@ -209,7 +209,7 @@ def put_empty( return client_raw_response def get_mbcs( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ▇█〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€ @@ -255,7 +255,7 @@ def get_mbcs( return deserialized def put_mbcs( - self, string_body, custom_headers={}, raw=False, **operation_config): + self, string_body, custom_headers=None, raw=False, **operation_config): """ Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ▇█〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€ @@ -302,7 +302,7 @@ def put_mbcs( return client_raw_response def get_whitespace( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get string value with leading and trailing whitespace 'Now is the time for all good men to come to the @@ -348,7 +348,7 @@ def get_whitespace( return deserialized def put_whitespace( - self, string_body, custom_headers={}, raw=False, **operation_config): + self, string_body, custom_headers=None, raw=False, **operation_config): """ Set String value with leading and trailing whitespace 'Now is the time for all good men to come to the @@ -394,7 +394,7 @@ def put_whitespace( return client_raw_response def get_not_provided( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get String value when no string value is sent in response payload @@ -438,7 +438,7 @@ def get_not_provided( return deserialized def get_base64_encoded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get value that is base64 encoded @@ -482,7 +482,7 @@ def get_base64_encoded( return deserialized def get_base64_url_encoded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get value that is base64url encoded @@ -526,7 +526,7 @@ def get_base64_url_encoded( return deserialized def put_base64_url_encoded( - self, string_body, custom_headers={}, raw=False, **operation_config): + self, string_body, custom_headers=None, raw=False, **operation_config): """ Put value that is base64url encoded @@ -569,7 +569,7 @@ def put_base64_url_encoded( return client_raw_response def get_null_base64_url_encoded( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get null value that is expected to be base64url encoded diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths.py index 4d021f1088d5..478f2a330a55 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUri/autorestparameterizedhosttestclient/operations/paths.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_empty( - self, account_name, custom_headers={}, raw=False, **operation_config): + self, account_name, custom_headers=None, raw=False, **operation_config): """ Get a 200 to test a valid base uri diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/operations/paths.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/operations/paths.py index 2c43f455f742..5d17c7e4a6b6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/operations/paths.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/CustomBaseUriMoreOptions/autorestparameterizedcustomhosttestclient/operations/paths.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_empty( - self, vault, secret, key_name, key_version="v1", custom_headers={}, raw=False, **operation_config): + self, vault, secret, key_name, key_version="v1", custom_headers=None, raw=False, **operation_config): """ Get a 200 to test a valid base uri diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/operations/header.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/operations/header.py index 609425c074ab..22fc077e71f6 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/operations/header.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Header/autorestswaggerbatheaderservice/operations/header.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def param_existing_key( - self, user_agent, custom_headers={}, raw=False, **operation_config): + self, user_agent, custom_headers=None, raw=False, **operation_config): """ Send a post request with header value "User-Agent": "overwrite" @@ -73,7 +73,7 @@ def param_existing_key( return client_raw_response def response_existing_key( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a response with header value "User-Agent": "overwrite" @@ -113,7 +113,7 @@ def response_existing_key( return client_raw_response def param_protected_key( - self, content_type, custom_headers={}, raw=False, **operation_config): + self, content_type, custom_headers=None, raw=False, **operation_config): """ Send a post request with header value "Content-Type": "text/html" @@ -154,7 +154,7 @@ def param_protected_key( return client_raw_response def response_protected_key( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get a response with header value "Content-Type": "text/html" @@ -194,7 +194,7 @@ def response_protected_key( return client_raw_response def param_integer( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "positive", "value": 1 or "scenario": "negative", "value": -2 @@ -239,7 +239,7 @@ def param_integer( return client_raw_response def response_integer( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header value "value": 1 or -2 @@ -283,7 +283,7 @@ def response_integer( return client_raw_response def param_long( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "positive", "value": 105 or "scenario": "negative", "value": -2 @@ -328,7 +328,7 @@ def param_long( return client_raw_response def response_long( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header value "value": 105 or -2 @@ -372,7 +372,7 @@ def response_long( return client_raw_response def param_float( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "positive", "value": 0.07 or "scenario": "negative", "value": -3.0 @@ -417,7 +417,7 @@ def param_float( return client_raw_response def response_float( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header value "value": 0.07 or -3.0 @@ -461,7 +461,7 @@ def response_float( return client_raw_response def param_double( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "positive", "value": 7e120 or "scenario": "negative", "value": -3.0 @@ -506,7 +506,7 @@ def param_double( return client_raw_response def response_double( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header value "value": 7e120 or -3.0 @@ -550,7 +550,7 @@ def response_double( return client_raw_response def param_bool( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "true", "value": true or "scenario": "false", "value": false @@ -595,7 +595,7 @@ def param_bool( return client_raw_response def response_bool( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header value "value": true or false @@ -639,7 +639,7 @@ def response_bool( return client_raw_response def param_string( - self, scenario, value=None, custom_headers={}, raw=False, **operation_config): + self, scenario, value=None, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "valid", "value": "The quick brown fox jumps over the lazy dog" or "scenario": "null", @@ -687,7 +687,7 @@ def param_string( return client_raw_response def response_string( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header values "The quick brown fox jumps over the lazy dog" or null or "" @@ -732,7 +732,7 @@ def response_string( return client_raw_response def param_date( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "valid", "value": "2010-01-01" or "scenario": "min", "value": "0001-01-01" @@ -778,7 +778,7 @@ def param_date( return client_raw_response def response_date( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header values "2010-01-01" or "0001-01-01" @@ -822,7 +822,7 @@ def response_date( return client_raw_response def param_datetime( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "valid", "value": "2010-01-01T12:34:56Z" or "scenario": "min", "value": @@ -869,7 +869,7 @@ def param_datetime( return client_raw_response def response_datetime( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z" @@ -914,7 +914,7 @@ def response_datetime( return client_raw_response def param_datetime_rfc1123( - self, scenario, value=None, custom_headers={}, raw=False, **operation_config): + self, scenario, value=None, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "valid", "value": "Wed, 01 Jan 2010 12:34:56 GMT" or "scenario": "min", "value": "Mon, @@ -962,7 +962,7 @@ def param_datetime_rfc1123( return client_raw_response def response_datetime_rfc1123( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT" @@ -1007,7 +1007,7 @@ def response_datetime_rfc1123( return client_raw_response def param_duration( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "valid", "value": "P123DT22H14M12.011S" @@ -1053,7 +1053,7 @@ def param_duration( return client_raw_response def response_duration( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header values "P123DT22H14M12.011S" @@ -1097,7 +1097,7 @@ def response_duration( return client_raw_response def param_byte( - self, scenario, value, custom_headers={}, raw=False, **operation_config): + self, scenario, value, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "valid", "value": "啊齄丂狛狜隣郎隣兀﨩" @@ -1142,7 +1142,7 @@ def param_byte( return client_raw_response def response_byte( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header values "啊齄丂狛狜隣郎隣兀﨩" @@ -1186,7 +1186,7 @@ def response_byte( return client_raw_response def param_enum( - self, scenario, value=None, custom_headers={}, raw=False, **operation_config): + self, scenario, value=None, custom_headers=None, raw=False, **operation_config): """ Send a post request with header values "scenario": "valid", "value": "GREY" or "scenario": "null", "value": null @@ -1234,7 +1234,7 @@ def param_enum( return client_raw_response def response_enum( - self, scenario, custom_headers={}, raw=False, **operation_config): + self, scenario, custom_headers=None, raw=False, **operation_config): """ Get a response with header values "GREY" or null @@ -1278,7 +1278,7 @@ def response_enum( return client_raw_response def custom_request_id( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_client_failure.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_client_failure.py index 64ad7a1e8b51..ec65a8c9a8dd 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_client_failure.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_client_failure.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def head400( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 400 status code - should be represented in the client as an error @@ -70,7 +70,7 @@ def head400( return client_raw_response def get400( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 400 status code - should be represented in the client as an error @@ -108,7 +108,7 @@ def get400( return client_raw_response def put400( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 400 status code - should be represented in the client as an error @@ -155,7 +155,7 @@ def put400( return client_raw_response def patch400( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 400 status code - should be represented in the client as an error @@ -202,7 +202,7 @@ def patch400( return client_raw_response def post400( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 400 status code - should be represented in the client as an error @@ -249,7 +249,7 @@ def post400( return client_raw_response def delete400( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 400 status code - should be represented in the client as an error @@ -296,7 +296,7 @@ def delete400( return client_raw_response def head401( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 401 status code - should be represented in the client as an error @@ -334,7 +334,7 @@ def head401( return client_raw_response def get402( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 402 status code - should be represented in the client as an error @@ -372,7 +372,7 @@ def get402( return client_raw_response def get403( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 403 status code - should be represented in the client as an error @@ -410,7 +410,7 @@ def get403( return client_raw_response def put404( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 404 status code - should be represented in the client as an error @@ -457,7 +457,7 @@ def put404( return client_raw_response def patch405( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 405 status code - should be represented in the client as an error @@ -504,7 +504,7 @@ def patch405( return client_raw_response def post406( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 406 status code - should be represented in the client as an error @@ -551,7 +551,7 @@ def post406( return client_raw_response def delete407( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 407 status code - should be represented in the client as an error @@ -598,7 +598,7 @@ def delete407( return client_raw_response def put409( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 409 status code - should be represented in the client as an error @@ -645,7 +645,7 @@ def put409( return client_raw_response def head410( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 410 status code - should be represented in the client as an error @@ -683,7 +683,7 @@ def head410( return client_raw_response def get411( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 411 status code - should be represented in the client as an error @@ -721,7 +721,7 @@ def get411( return client_raw_response def get412( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 412 status code - should be represented in the client as an error @@ -759,7 +759,7 @@ def get412( return client_raw_response def put413( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 413 status code - should be represented in the client as an error @@ -806,7 +806,7 @@ def put413( return client_raw_response def patch414( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 414 status code - should be represented in the client as an error @@ -853,7 +853,7 @@ def patch414( return client_raw_response def post415( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 415 status code - should be represented in the client as an error @@ -900,7 +900,7 @@ def post415( return client_raw_response def get416( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 416 status code - should be represented in the client as an error @@ -938,7 +938,7 @@ def get416( return client_raw_response def delete417( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 417 status code - should be represented in the client as an error @@ -985,7 +985,7 @@ def delete417( return client_raw_response def head429( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 429 status code - should be represented in the client as an error diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_failure.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_failure.py index 3b6bcfdadbf4..52f9489f4885 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_failure.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_failure.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_empty_error( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get empty error form server @@ -77,7 +77,7 @@ def get_empty_error( return deserialized def get_no_model_error( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get empty error form server diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_redirects.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_redirects.py index 4ad297537511..ac3da64a466c 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_redirects.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_redirects.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def head300( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 300 status code and redirect to /http/success/200 @@ -72,7 +72,7 @@ def head300( return client_raw_response def get300( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 300 status code and redirect to /http/success/200 @@ -121,7 +121,7 @@ def get300( return deserialized def head301( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 301 status code and redirect to /http/success/200 @@ -161,7 +161,7 @@ def head301( return client_raw_response def get301( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 301 status code and redirect to /http/success/200 @@ -201,7 +201,7 @@ def get301( return client_raw_response def put301( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Put true Boolean value in request returns 301. This request should not be automatically redirected, but should return the received 301 @@ -252,7 +252,7 @@ def put301( return client_raw_response def head302( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 302 status code and redirect to /http/success/200 @@ -292,7 +292,7 @@ def head302( return client_raw_response def get302( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 302 status code and redirect to /http/success/200 @@ -332,7 +332,7 @@ def get302( return client_raw_response def patch302( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 @@ -383,7 +383,7 @@ def patch302( return client_raw_response def post303( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 @@ -434,7 +434,7 @@ def post303( return client_raw_response def head307( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Redirect with 307, resulting in a 200 success @@ -474,7 +474,7 @@ def head307( return client_raw_response def get307( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Redirect get with 307, resulting in a 200 success @@ -514,7 +514,7 @@ def get307( return client_raw_response def put307( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Put redirected with 307, resulting in a 200 after redirect @@ -563,7 +563,7 @@ def put307( return client_raw_response def patch307( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Patch redirected with 307, resulting in a 200 after redirect @@ -612,7 +612,7 @@ def patch307( return client_raw_response def post307( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Post redirected with 307, resulting in a 200 after redirect @@ -661,7 +661,7 @@ def post307( return client_raw_response def delete307( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Delete redirected with 307, resulting in a 200 after redirect diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_retry.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_retry.py index 0356348b5f2d..599a89f87926 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_retry.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_retry.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def head408( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 408 status code, then 200 after retry @@ -69,7 +69,7 @@ def head408( return client_raw_response def put500( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 500 status code, then 200 after retry @@ -115,7 +115,7 @@ def put500( return client_raw_response def patch500( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 500 status code, then 200 after retry @@ -161,7 +161,7 @@ def patch500( return client_raw_response def get502( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 502 status code, then 200 after retry @@ -198,7 +198,7 @@ def get502( return client_raw_response def post503( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 503 status code, then 200 after retry @@ -244,7 +244,7 @@ def post503( return client_raw_response def delete503( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 503 status code, then 200 after retry @@ -290,7 +290,7 @@ def delete503( return client_raw_response def put504( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 504 status code, then 200 after retry @@ -336,7 +336,7 @@ def put504( return client_raw_response def patch504( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 504 status code, then 200 after retry diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_server_failure.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_server_failure.py index 761dead10b8e..94181adb6171 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_server_failure.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_server_failure.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def head501( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 501 status code - should be represented in the client as an error @@ -70,7 +70,7 @@ def head501( return client_raw_response def get501( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 501 status code - should be represented in the client as an error @@ -108,7 +108,7 @@ def get501( return client_raw_response def post505( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 505 status code - should be represented in the client as an error @@ -155,7 +155,7 @@ def post505( return client_raw_response def delete505( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Return 505 status code - should be represented in the client as an error diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_success.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_success.py index 1334f8b0c28a..b5ff9b7873ae 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_success.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_success.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def head200( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 200 status code if successful @@ -69,7 +69,7 @@ def head200( return client_raw_response def get200( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get 200 success @@ -113,7 +113,7 @@ def get200( return deserialized def put200( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Put boolean value true returning 200 success @@ -159,7 +159,7 @@ def put200( return client_raw_response def patch200( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Patch true Boolean value in request returning 200 @@ -205,7 +205,7 @@ def patch200( return client_raw_response def post200( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Post bollean value true in request that returns a 200 @@ -251,7 +251,7 @@ def post200( return client_raw_response def delete200( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Delete simple boolean value true returns 200 @@ -297,7 +297,7 @@ def delete200( return client_raw_response def put201( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Put true Boolean value in request returns 201 @@ -343,7 +343,7 @@ def put201( return client_raw_response def post201( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Post true Boolean value in request returns 201 (Created) @@ -389,7 +389,7 @@ def post201( return client_raw_response def put202( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Put true Boolean value in request returns 202 (Accepted) @@ -435,7 +435,7 @@ def put202( return client_raw_response def patch202( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Patch true Boolean value in request returns 202 @@ -481,7 +481,7 @@ def patch202( return client_raw_response def post202( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Post true Boolean value in request returns 202 (Accepted) @@ -527,7 +527,7 @@ def post202( return client_raw_response def delete202( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Delete true Boolean value in request returns 202 (accepted) @@ -573,7 +573,7 @@ def delete202( return client_raw_response def head204( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 204 status code if successful @@ -610,7 +610,7 @@ def head204( return client_raw_response def put204( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Put true Boolean value in request returns 204 (no content) @@ -656,7 +656,7 @@ def put204( return client_raw_response def patch204( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Patch true Boolean value in request returns 204 (no content) @@ -702,7 +702,7 @@ def patch204( return client_raw_response def post204( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Post true Boolean value in request returns 204 (no content) @@ -748,7 +748,7 @@ def post204( return client_raw_response def delete204( - self, boolean_value=None, custom_headers={}, raw=False, **operation_config): + self, boolean_value=None, custom_headers=None, raw=False, **operation_config): """ Delete true Boolean value in request returns 204 (no content) @@ -794,7 +794,7 @@ def delete204( return client_raw_response def head404( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Return 404 status code diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/multiple_responses.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/multiple_responses.py index 04a9b92e59fa..486c5e5fbf36 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/multiple_responses.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/multiple_responses.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get200_model204_no_model_default_error200_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with valid payload: {'statusCode': '200'} @@ -77,7 +77,7 @@ def get200_model204_no_model_default_error200_valid( return deserialized def get200_model204_no_model_default_error204_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 204 response with no payload @@ -121,7 +121,7 @@ def get200_model204_no_model_default_error204_valid( return deserialized def get200_model204_no_model_default_error201_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 201 response with valid payload: {'statusCode': '201'} @@ -165,7 +165,7 @@ def get200_model204_no_model_default_error201_invalid( return deserialized def get200_model204_no_model_default_error202_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 202 response with no payload: @@ -209,7 +209,7 @@ def get200_model204_no_model_default_error202_none( return deserialized def get200_model204_no_model_default_error400_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'} @@ -254,7 +254,7 @@ def get200_model204_no_model_default_error400_valid( return deserialized def get200_model201_model_default_error200_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with valid payload: {'statusCode': '200'} @@ -300,7 +300,7 @@ def get200_model201_model_default_error200_valid( return deserialized def get200_model201_model_default_error201_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'} @@ -347,7 +347,7 @@ def get200_model201_model_default_error201_valid( return deserialized def get200_model201_model_default_error400_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with valid payload: {'code': '400', 'message': 'client error'} @@ -394,7 +394,7 @@ def get200_model201_model_default_error400_valid( return deserialized def get200_model_a201_model_c404_model_ddefault_error200_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with valid payload: {'statusCode': '200'} @@ -442,7 +442,7 @@ def get200_model_a201_model_c404_model_ddefault_error200_valid( return deserialized def get200_model_a201_model_c404_model_ddefault_error201_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with valid payload: {'httpCode': '201'} @@ -490,7 +490,7 @@ def get200_model_a201_model_c404_model_ddefault_error201_valid( return deserialized def get200_model_a201_model_c404_model_ddefault_error404_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with valid payload: {'httpStatusCode': '404'} @@ -538,7 +538,7 @@ def get200_model_a201_model_c404_model_ddefault_error404_valid( return deserialized def get200_model_a201_model_c404_model_ddefault_error400_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with valid payload: {'code': '400', 'message': 'client error'} @@ -587,7 +587,7 @@ def get200_model_a201_model_c404_model_ddefault_error400_valid( return deserialized def get202_none204_none_default_error202_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 202 response with no payload @@ -624,7 +624,7 @@ def get202_none204_none_default_error202_none( return client_raw_response def get202_none204_none_default_error204_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 204 response with no payload @@ -661,7 +661,7 @@ def get202_none204_none_default_error204_none( return client_raw_response def get202_none204_none_default_error400_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with valid payload: {'code': '400', 'message': 'client error'} @@ -699,7 +699,7 @@ def get202_none204_none_default_error400_valid( return client_raw_response def get202_none204_none_default_none202_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 202 response with an unexpected payload {'property': 'value'} @@ -736,7 +736,7 @@ def get202_none204_none_default_none202_invalid( return client_raw_response def get202_none204_none_default_none204_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 204 response with no payload @@ -773,7 +773,7 @@ def get202_none204_none_default_none204_none( return client_raw_response def get202_none204_none_default_none400_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with no payload @@ -810,7 +810,7 @@ def get202_none204_none_default_none400_none( return client_raw_response def get202_none204_none_default_none400_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with an unexpected payload {'property': 'value'} @@ -847,7 +847,7 @@ def get202_none204_none_default_none400_invalid( return client_raw_response def get_default_model_a200_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with valid payload: {'statusCode': '200'} @@ -884,7 +884,7 @@ def get_default_model_a200_valid( return client_raw_response def get_default_model_a200_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with no payload @@ -921,7 +921,7 @@ def get_default_model_a200_none( return client_raw_response def get_default_model_a400_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with valid payload: {'statusCode': '400'} @@ -958,7 +958,7 @@ def get_default_model_a400_valid( return client_raw_response def get_default_model_a400_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with no payload @@ -995,7 +995,7 @@ def get_default_model_a400_none( return client_raw_response def get_default_none200_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with invalid payload: {'statusCode': '200'} @@ -1032,7 +1032,7 @@ def get_default_none200_invalid( return client_raw_response def get_default_none200_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with no payload @@ -1069,7 +1069,7 @@ def get_default_none200_none( return client_raw_response def get_default_none400_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with valid payload: {'statusCode': '400'} @@ -1106,7 +1106,7 @@ def get_default_none400_invalid( return client_raw_response def get_default_none400_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with no payload @@ -1143,7 +1143,7 @@ def get_default_none400_none( return client_raw_response def get200_model_a200_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A @@ -1188,7 +1188,7 @@ def get200_model_a200_none( return deserialized def get200_model_a200_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with payload {'statusCode': '200'} @@ -1232,7 +1232,7 @@ def get200_model_a200_valid( return deserialized def get200_model_a200_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with invalid payload {'statusCodeInvalid': '200'} @@ -1276,7 +1276,7 @@ def get200_model_a200_invalid( return deserialized def get200_model_a400_none( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 400 response with no payload client should treat as an http error with no error model @@ -1321,7 +1321,7 @@ def get200_model_a400_none( return deserialized def get200_model_a400_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with payload {'statusCode': '400'} @@ -1365,7 +1365,7 @@ def get200_model_a400_valid( return deserialized def get200_model_a400_invalid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 200 response with invalid payload {'statusCodeInvalid': '400'} @@ -1409,7 +1409,7 @@ def get200_model_a400_invalid( return deserialized def get200_model_a202_valid( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Send a 202 response with payload {'statusCode': '202'} diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py index 843afe11e490..77be907a6946 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/auto_rest_resource_flattening_test_service.py @@ -58,7 +58,7 @@ def __init__( def put_array( - self, resource_array=None, custom_headers={}, raw=False, **operation_config): + self, resource_array=None, custom_headers=None, raw=False, **operation_config): """ Put External Resource as an Array @@ -105,7 +105,7 @@ def put_array( return client_raw_response def get_array( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get External Resource as an Array @@ -150,7 +150,7 @@ def get_array( return deserialized def put_dictionary( - self, resource_dictionary=None, custom_headers={}, raw=False, **operation_config): + self, resource_dictionary=None, custom_headers=None, raw=False, **operation_config): """ Put External Resource as a Dictionary @@ -196,7 +196,7 @@ def put_dictionary( return client_raw_response def get_dictionary( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get External Resource as a Dictionary @@ -240,7 +240,7 @@ def get_dictionary( return deserialized def put_resource_collection( - self, resource_complex_object=None, custom_headers={}, raw=False, **operation_config): + self, resource_complex_object=None, custom_headers=None, raw=False, **operation_config): """ Put External Resource as a ResourceCollection @@ -288,7 +288,7 @@ def put_resource_collection( return client_raw_response def get_resource_collection( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get External Resource as a ResourceCollection @@ -333,7 +333,7 @@ def get_resource_collection( return deserialized def put_simple_product( - self, simple_body_product=None, custom_headers={}, raw=False, **operation_config): + self, simple_body_product=None, custom_headers=None, raw=False, **operation_config): """ Put Simple Product with client flattening true on the model @@ -388,7 +388,7 @@ def put_simple_product( return deserialized def post_flattened_simple_product( - self, product_id, max_product_display_name, description=None, generic_value=None, odatavalue=None, custom_headers={}, raw=False, **operation_config): + self, product_id, max_product_display_name, description=None, generic_value=None, odatavalue=None, custom_headers=None, raw=False, **operation_config): """ Put Flattened Simple Product with client flattening true on the parameter @@ -457,7 +457,7 @@ def post_flattened_simple_product( return deserialized def put_simple_product_with_grouping( - self, flatten_parameter_group, custom_headers={}, raw=False, **operation_config): + self, flatten_parameter_group, custom_headers=None, raw=False, **operation_config): """ Put Simple Product with client flattening true on the model diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py index ec69672916dc..a45da1f5bfd7 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ParameterFlattening/autorestparameterflattening/operations/availability_sets.py @@ -33,7 +33,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def update( - self, resource_group_name, avset, tags, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, avset, tags, custom_headers=None, raw=False, **operation_config): """ Updates the tags for an availability set. diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py index 59192a6fd23b..caa51db50051 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Report/autorestreportservice/auto_rest_report_service.py @@ -58,7 +58,7 @@ def __init__( def get_report( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Get test coverage report diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py index 4f56d1d617c0..359feac46339 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def post_required_integer_parameter( - self, body_parameter, custom_headers={}, raw=False, **operation_config): + self, body_parameter, custom_headers=None, raw=False, **operation_config): """ Test explicitly required integer. Please put null and the client library should throw before the request is sent. @@ -77,7 +77,7 @@ def post_required_integer_parameter( return client_raw_response def post_optional_integer_parameter( - self, body_parameter=None, custom_headers={}, raw=False, **operation_config): + self, body_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional integer. Please put null. @@ -123,7 +123,7 @@ def post_optional_integer_parameter( return client_raw_response def post_required_integer_property( - self, value, custom_headers={}, raw=False, **operation_config): + self, value, custom_headers=None, raw=False, **operation_config): """ Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request @@ -171,7 +171,7 @@ def post_required_integer_property( return client_raw_response def post_optional_integer_property( - self, value=None, custom_headers={}, raw=False, **operation_config): + self, value=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. @@ -222,7 +222,7 @@ def post_optional_integer_property( return client_raw_response def post_required_integer_header( - self, header_parameter, custom_headers={}, raw=False, **operation_config): + self, header_parameter, custom_headers=None, raw=False, **operation_config): """ Test explicitly required integer. Please put a header 'headerParameter' => null and the client library should throw before @@ -265,7 +265,7 @@ def post_required_integer_header( return client_raw_response def post_optional_integer_header( - self, header_parameter=None, custom_headers={}, raw=False, **operation_config): + self, header_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional integer. Please put a header 'headerParameter' => null. @@ -307,7 +307,7 @@ def post_optional_integer_header( return client_raw_response def post_required_string_parameter( - self, body_parameter, custom_headers={}, raw=False, **operation_config): + self, body_parameter, custom_headers=None, raw=False, **operation_config): """ Test explicitly required string. Please put null and the client library should throw before the request is sent. @@ -352,7 +352,7 @@ def post_required_string_parameter( return client_raw_response def post_optional_string_parameter( - self, body_parameter=None, custom_headers={}, raw=False, **operation_config): + self, body_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional string. Please put null. @@ -398,7 +398,7 @@ def post_optional_string_parameter( return client_raw_response def post_required_string_property( - self, value, custom_headers={}, raw=False, **operation_config): + self, value, custom_headers=None, raw=False, **operation_config): """ Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the @@ -446,7 +446,7 @@ def post_required_string_property( return client_raw_response def post_optional_string_property( - self, value=None, custom_headers={}, raw=False, **operation_config): + self, value=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. @@ -497,7 +497,7 @@ def post_optional_string_property( return client_raw_response def post_required_string_header( - self, header_parameter, custom_headers={}, raw=False, **operation_config): + self, header_parameter, custom_headers=None, raw=False, **operation_config): """ Test explicitly required string. Please put a header 'headerParameter' => null and the client library should throw before the request is @@ -540,7 +540,7 @@ def post_required_string_header( return client_raw_response def post_optional_string_header( - self, body_parameter=None, custom_headers={}, raw=False, **operation_config): + self, body_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional string. Please put a header 'headerParameter' => null. @@ -582,7 +582,7 @@ def post_optional_string_header( return client_raw_response def post_required_class_parameter( - self, body_parameter, custom_headers={}, raw=False, **operation_config): + self, body_parameter, custom_headers=None, raw=False, **operation_config): """ Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -628,7 +628,7 @@ def post_required_class_parameter( return client_raw_response def post_optional_class_parameter( - self, body_parameter=None, custom_headers={}, raw=False, **operation_config): + self, body_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional complex object. Please put null. @@ -675,7 +675,7 @@ def post_optional_class_parameter( return client_raw_response def post_required_class_property( - self, value, custom_headers={}, raw=False, **operation_config): + self, value, custom_headers=None, raw=False, **operation_config): """ Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw @@ -724,7 +724,7 @@ def post_required_class_property( return client_raw_response def post_optional_class_property( - self, value=None, custom_headers={}, raw=False, **operation_config): + self, value=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. @@ -776,7 +776,7 @@ def post_optional_class_property( return client_raw_response def post_required_array_parameter( - self, body_parameter, custom_headers={}, raw=False, **operation_config): + self, body_parameter, custom_headers=None, raw=False, **operation_config): """ Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -821,7 +821,7 @@ def post_required_array_parameter( return client_raw_response def post_optional_array_parameter( - self, body_parameter=None, custom_headers={}, raw=False, **operation_config): + self, body_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional array. Please put null. @@ -867,7 +867,7 @@ def post_optional_array_parameter( return client_raw_response def post_required_array_property( - self, value, custom_headers={}, raw=False, **operation_config): + self, value, custom_headers=None, raw=False, **operation_config): """ Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request @@ -915,7 +915,7 @@ def post_required_array_property( return client_raw_response def post_optional_array_property( - self, value=None, custom_headers={}, raw=False, **operation_config): + self, value=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. @@ -966,7 +966,7 @@ def post_optional_array_property( return client_raw_response def post_required_array_header( - self, header_parameter, custom_headers={}, raw=False, **operation_config): + self, header_parameter, custom_headers=None, raw=False, **operation_config): """ Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is @@ -1009,7 +1009,7 @@ def post_required_array_header( return client_raw_response def post_optional_array_header( - self, header_parameter=None, custom_headers={}, raw=False, **operation_config): + self, header_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test explicitly optional integer. Please put a header 'headerParameter' => null. diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/implicit.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/implicit.py index cddb3b124e65..91919cfd00ca 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/implicit.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/implicit.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_required_path( - self, path_parameter, custom_headers={}, raw=False, **operation_config): + self, path_parameter, custom_headers=None, raw=False, **operation_config): """ Test implicitly required path parameter @@ -76,7 +76,7 @@ def get_required_path( return client_raw_response def put_optional_query( - self, query_parameter=None, custom_headers={}, raw=False, **operation_config): + self, query_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test implicitly optional query parameter @@ -117,7 +117,7 @@ def put_optional_query( return client_raw_response def put_optional_header( - self, query_parameter=None, custom_headers={}, raw=False, **operation_config): + self, query_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test implicitly optional header parameter @@ -158,7 +158,7 @@ def put_optional_header( return client_raw_response def put_optional_body( - self, body_parameter=None, custom_headers={}, raw=False, **operation_config): + self, body_parameter=None, custom_headers=None, raw=False, **operation_config): """ Test implicitly optional body parameter @@ -204,7 +204,7 @@ def put_optional_body( return client_raw_response def get_required_global_path( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Test implicitly required path parameter @@ -246,7 +246,7 @@ def get_required_global_path( return client_raw_response def get_required_global_query( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Test implicitly required query parameter @@ -285,7 +285,7 @@ def get_required_global_query( return client_raw_response def get_optional_global_query( - self, custom_headers={}, raw=False, **operation_config): + self, custom_headers=None, raw=False, **operation_config): """ Test implicitly optional query parameter diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/path_items.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/path_items.py index 52f1f2feba02..d3f3e72c6ea3 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/path_items.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/path_items.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_all_with_values( - self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers={}, raw=False, **operation_config): + self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers=None, raw=False, **operation_config): """ send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', @@ -96,7 +96,7 @@ def get_all_with_values( return client_raw_response def get_global_query_null( - self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers={}, raw=False, **operation_config): + self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers=None, raw=False, **operation_config): """ send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', @@ -159,7 +159,7 @@ def get_global_query_null( return client_raw_response def get_global_and_local_query_null( - self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers={}, raw=False, **operation_config): + self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers=None, raw=False, **operation_config): """ send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', @@ -221,7 +221,7 @@ def get_global_and_local_query_null( return client_raw_response def get_local_path_item_query_null( - self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers={}, raw=False, **operation_config): + self, local_string_path, path_item_string_path, local_string_query=None, path_item_string_query=None, custom_headers=None, raw=False, **operation_config): """ send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py index 9084ae4dc964..c5e497e11e4f 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/paths.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_boolean_true( - self, bool_path=False, custom_headers={}, raw=False, **operation_config): + self, bool_path=False, custom_headers=None, raw=False, **operation_config): """ Get true Boolean value on path @@ -75,7 +75,7 @@ def get_boolean_true( return client_raw_response def get_boolean_false( - self, bool_path=False, custom_headers={}, raw=False, **operation_config): + self, bool_path=False, custom_headers=None, raw=False, **operation_config): """ Get false Boolean value on path @@ -118,7 +118,7 @@ def get_boolean_false( return client_raw_response def get_int_one_million( - self, int_path=1000000, custom_headers={}, raw=False, **operation_config): + self, int_path=1000000, custom_headers=None, raw=False, **operation_config): """ Get '1000000' integer value @@ -161,7 +161,7 @@ def get_int_one_million( return client_raw_response def get_int_negative_one_million( - self, int_path=-1000000, custom_headers={}, raw=False, **operation_config): + self, int_path=-1000000, custom_headers=None, raw=False, **operation_config): """ Get '-1000000' integer value @@ -204,7 +204,7 @@ def get_int_negative_one_million( return client_raw_response def get_ten_billion( - self, long_path=10000000000, custom_headers={}, raw=False, **operation_config): + self, long_path=10000000000, custom_headers=None, raw=False, **operation_config): """ Get '10000000000' 64 bit integer value @@ -247,7 +247,7 @@ def get_ten_billion( return client_raw_response def get_negative_ten_billion( - self, long_path=-10000000000, custom_headers={}, raw=False, **operation_config): + self, long_path=-10000000000, custom_headers=None, raw=False, **operation_config): """ Get '-10000000000' 64 bit integer value @@ -290,7 +290,7 @@ def get_negative_ten_billion( return client_raw_response def float_scientific_positive( - self, float_path=1.034E+20, custom_headers={}, raw=False, **operation_config): + self, float_path=1.034E+20, custom_headers=None, raw=False, **operation_config): """ Get '1.034E+20' numeric value @@ -333,7 +333,7 @@ def float_scientific_positive( return client_raw_response def float_scientific_negative( - self, float_path=-1.034E-20, custom_headers={}, raw=False, **operation_config): + self, float_path=-1.034E-20, custom_headers=None, raw=False, **operation_config): """ Get '-1.034E-20' numeric value @@ -376,7 +376,7 @@ def float_scientific_negative( return client_raw_response def double_decimal_positive( - self, double_path=9999999.999, custom_headers={}, raw=False, **operation_config): + self, double_path=9999999.999, custom_headers=None, raw=False, **operation_config): """ Get '9999999.999' numeric value @@ -419,7 +419,7 @@ def double_decimal_positive( return client_raw_response def double_decimal_negative( - self, double_path=-9999999.999, custom_headers={}, raw=False, **operation_config): + self, double_path=-9999999.999, custom_headers=None, raw=False, **operation_config): """ Get '-9999999.999' numeric value @@ -462,7 +462,7 @@ def double_decimal_negative( return client_raw_response def string_unicode( - self, string_path="啊齄丂狛狜隣郎隣兀﨩", custom_headers={}, raw=False, **operation_config): + self, string_path="啊齄丂狛狜隣郎隣兀﨩", custom_headers=None, raw=False, **operation_config): """ Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value @@ -505,7 +505,7 @@ def string_unicode( return client_raw_response def string_url_encoded( - self, string_path="begin!*'();:@ &=+$,/?#[]end", custom_headers={}, raw=False, **operation_config): + self, string_path="begin!*'();:@ &=+$,/?#[]end", custom_headers=None, raw=False, **operation_config): """ Get 'begin!*'();:@ &=+$,/?#[]end @@ -549,7 +549,7 @@ def string_url_encoded( return client_raw_response def string_empty( - self, string_path="", custom_headers={}, raw=False, **operation_config): + self, string_path="", custom_headers=None, raw=False, **operation_config): """ Get '' @@ -592,7 +592,7 @@ def string_empty( return client_raw_response def string_null( - self, string_path, custom_headers={}, raw=False, **operation_config): + self, string_path, custom_headers=None, raw=False, **operation_config): """ Get null (should throw) @@ -635,7 +635,7 @@ def string_null( return client_raw_response def enum_valid( - self, enum_path, custom_headers={}, raw=False, **operation_config): + self, enum_path, custom_headers=None, raw=False, **operation_config): """ Get using uri with 'green color' in path parameter @@ -680,7 +680,7 @@ def enum_valid( return client_raw_response def enum_null( - self, enum_path, custom_headers={}, raw=False, **operation_config): + self, enum_path, custom_headers=None, raw=False, **operation_config): """ Get null (should throw on the client before the request is sent on wire) @@ -726,7 +726,7 @@ def enum_null( return client_raw_response def byte_multi_byte( - self, byte_path, custom_headers={}, raw=False, **operation_config): + self, byte_path, custom_headers=None, raw=False, **operation_config): """ Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array @@ -770,7 +770,7 @@ def byte_multi_byte( return client_raw_response def byte_empty( - self, byte_path=bytearray("", encoding="utf-8"), custom_headers={}, raw=False, **operation_config): + self, byte_path=bytearray("", encoding="utf-8"), custom_headers=None, raw=False, **operation_config): """ Get '' as byte array @@ -813,7 +813,7 @@ def byte_empty( return client_raw_response def byte_null( - self, byte_path, custom_headers={}, raw=False, **operation_config): + self, byte_path, custom_headers=None, raw=False, **operation_config): """ Get null as byte array (should throw) @@ -856,7 +856,7 @@ def byte_null( return client_raw_response def date_valid( - self, date_path, custom_headers={}, raw=False, **operation_config): + self, date_path, custom_headers=None, raw=False, **operation_config): """ Get '2012-01-01' as date @@ -899,7 +899,7 @@ def date_valid( return client_raw_response def date_null( - self, date_path, custom_headers={}, raw=False, **operation_config): + self, date_path, custom_headers=None, raw=False, **operation_config): """ Get null as date - this should throw or be unusable on the client side, depending on date representation @@ -943,7 +943,7 @@ def date_null( return client_raw_response def date_time_valid( - self, date_time_path, custom_headers={}, raw=False, **operation_config): + self, date_time_path, custom_headers=None, raw=False, **operation_config): """ Get '2012-01-01T01:01:01Z' as date-time @@ -986,7 +986,7 @@ def date_time_valid( return client_raw_response def date_time_null( - self, date_time_path, custom_headers={}, raw=False, **operation_config): + self, date_time_path, custom_headers=None, raw=False, **operation_config): """ Get null as date-time, should be disallowed or throw depending on representation of date-time @@ -1030,7 +1030,7 @@ def date_time_null( return client_raw_response def base64_url( - self, base64_url_path, custom_headers={}, raw=False, **operation_config): + self, base64_url_path, custom_headers=None, raw=False, **operation_config): """ Get 'lorem' encoded value as 'bG9yZW0' (base64url) @@ -1073,7 +1073,7 @@ def base64_url( return client_raw_response def array_csv_in_path( - self, array_path, custom_headers={}, raw=False, **operation_config): + self, array_path, custom_headers=None, raw=False, **operation_config): """ Get an array of string ['ArrayPath1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format @@ -1118,7 +1118,7 @@ def array_csv_in_path( return client_raw_response def unix_time_url( - self, unix_time_url_path, custom_headers={}, raw=False, **operation_config): + self, unix_time_url_path, custom_headers=None, raw=False, **operation_config): """ Get the date 2016-04-13 encoded value as '1460505600' (Unix time) diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/queries.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/queries.py index b0e4ea195543..309ef289b50d 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/queries.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Url/autoresturltestservice/operations/queries.py @@ -32,7 +32,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def get_boolean_true( - self, bool_query=False, custom_headers={}, raw=False, **operation_config): + self, bool_query=False, custom_headers=None, raw=False, **operation_config): """ Get true Boolean value on path @@ -72,7 +72,7 @@ def get_boolean_true( return client_raw_response def get_boolean_false( - self, bool_query=False, custom_headers={}, raw=False, **operation_config): + self, bool_query=False, custom_headers=None, raw=False, **operation_config): """ Get false Boolean value on path @@ -112,7 +112,7 @@ def get_boolean_false( return client_raw_response def get_boolean_null( - self, bool_query=None, custom_headers={}, raw=False, **operation_config): + self, bool_query=None, custom_headers=None, raw=False, **operation_config): """ Get null Boolean value on query (query string should be absent) @@ -153,7 +153,7 @@ def get_boolean_null( return client_raw_response def get_int_one_million( - self, int_query=1000000, custom_headers={}, raw=False, **operation_config): + self, int_query=1000000, custom_headers=None, raw=False, **operation_config): """ Get '1000000' integer value @@ -193,7 +193,7 @@ def get_int_one_million( return client_raw_response def get_int_negative_one_million( - self, int_query=-1000000, custom_headers={}, raw=False, **operation_config): + self, int_query=-1000000, custom_headers=None, raw=False, **operation_config): """ Get '-1000000' integer value @@ -233,7 +233,7 @@ def get_int_negative_one_million( return client_raw_response def get_int_null( - self, int_query=None, custom_headers={}, raw=False, **operation_config): + self, int_query=None, custom_headers=None, raw=False, **operation_config): """ Get null integer value (no query parameter) @@ -274,7 +274,7 @@ def get_int_null( return client_raw_response def get_ten_billion( - self, long_query=10000000000, custom_headers={}, raw=False, **operation_config): + self, long_query=10000000000, custom_headers=None, raw=False, **operation_config): """ Get '10000000000' 64 bit integer value @@ -314,7 +314,7 @@ def get_ten_billion( return client_raw_response def get_negative_ten_billion( - self, long_query=-10000000000, custom_headers={}, raw=False, **operation_config): + self, long_query=-10000000000, custom_headers=None, raw=False, **operation_config): """ Get '-10000000000' 64 bit integer value @@ -354,7 +354,7 @@ def get_negative_ten_billion( return client_raw_response def get_long_null( - self, long_query=None, custom_headers={}, raw=False, **operation_config): + self, long_query=None, custom_headers=None, raw=False, **operation_config): """ Get 'null 64 bit integer value (no query param in uri) @@ -395,7 +395,7 @@ def get_long_null( return client_raw_response def float_scientific_positive( - self, float_query=1.034E+20, custom_headers={}, raw=False, **operation_config): + self, float_query=1.034E+20, custom_headers=None, raw=False, **operation_config): """ Get '1.034E+20' numeric value @@ -435,7 +435,7 @@ def float_scientific_positive( return client_raw_response def float_scientific_negative( - self, float_query=-1.034E-20, custom_headers={}, raw=False, **operation_config): + self, float_query=-1.034E-20, custom_headers=None, raw=False, **operation_config): """ Get '-1.034E-20' numeric value @@ -475,7 +475,7 @@ def float_scientific_negative( return client_raw_response def float_null( - self, float_query=None, custom_headers={}, raw=False, **operation_config): + self, float_query=None, custom_headers=None, raw=False, **operation_config): """ Get null numeric value (no query parameter) @@ -516,7 +516,7 @@ def float_null( return client_raw_response def double_decimal_positive( - self, double_query=9999999.999, custom_headers={}, raw=False, **operation_config): + self, double_query=9999999.999, custom_headers=None, raw=False, **operation_config): """ Get '9999999.999' numeric value @@ -556,7 +556,7 @@ def double_decimal_positive( return client_raw_response def double_decimal_negative( - self, double_query=-9999999.999, custom_headers={}, raw=False, **operation_config): + self, double_query=-9999999.999, custom_headers=None, raw=False, **operation_config): """ Get '-9999999.999' numeric value @@ -596,7 +596,7 @@ def double_decimal_negative( return client_raw_response def double_null( - self, double_query=None, custom_headers={}, raw=False, **operation_config): + self, double_query=None, custom_headers=None, raw=False, **operation_config): """ Get null numeric value (no query parameter) @@ -637,7 +637,7 @@ def double_null( return client_raw_response def string_unicode( - self, string_query="啊齄丂狛狜隣郎隣兀﨩", custom_headers={}, raw=False, **operation_config): + self, string_query="啊齄丂狛狜隣郎隣兀﨩", custom_headers=None, raw=False, **operation_config): """ Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value @@ -677,7 +677,7 @@ def string_unicode( return client_raw_response def string_url_encoded( - self, string_query="begin!*'();:@ &=+$,/?#[]end", custom_headers={}, raw=False, **operation_config): + self, string_query="begin!*'();:@ &=+$,/?#[]end", custom_headers=None, raw=False, **operation_config): """ Get 'begin!*'();:@ &=+$,/?#[]end @@ -718,7 +718,7 @@ def string_url_encoded( return client_raw_response def string_empty( - self, string_query="", custom_headers={}, raw=False, **operation_config): + self, string_query="", custom_headers=None, raw=False, **operation_config): """ Get '' @@ -758,7 +758,7 @@ def string_empty( return client_raw_response def string_null( - self, string_query=None, custom_headers={}, raw=False, **operation_config): + self, string_query=None, custom_headers=None, raw=False, **operation_config): """ Get null (no query parameter in url) @@ -799,7 +799,7 @@ def string_null( return client_raw_response def enum_valid( - self, enum_query=None, custom_headers={}, raw=False, **operation_config): + self, enum_query=None, custom_headers=None, raw=False, **operation_config): """ Get using uri with query parameter 'green color' @@ -842,7 +842,7 @@ def enum_valid( return client_raw_response def enum_null( - self, enum_query=None, custom_headers={}, raw=False, **operation_config): + self, enum_query=None, custom_headers=None, raw=False, **operation_config): """ Get null (no query parameter in url) @@ -885,7 +885,7 @@ def enum_null( return client_raw_response def byte_multi_byte( - self, byte_query=None, custom_headers={}, raw=False, **operation_config): + self, byte_query=None, custom_headers=None, raw=False, **operation_config): """ Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array @@ -927,7 +927,7 @@ def byte_multi_byte( return client_raw_response def byte_empty( - self, byte_query=bytearray("", encoding="utf-8"), custom_headers={}, raw=False, **operation_config): + self, byte_query=bytearray("", encoding="utf-8"), custom_headers=None, raw=False, **operation_config): """ Get '' as byte array @@ -967,7 +967,7 @@ def byte_empty( return client_raw_response def byte_null( - self, byte_query=None, custom_headers={}, raw=False, **operation_config): + self, byte_query=None, custom_headers=None, raw=False, **operation_config): """ Get null as byte array (no query parameters in uri) @@ -1008,7 +1008,7 @@ def byte_null( return client_raw_response def date_valid( - self, date_query, custom_headers={}, raw=False, **operation_config): + self, date_query, custom_headers=None, raw=False, **operation_config): """ Get '2012-01-01' as date @@ -1048,7 +1048,7 @@ def date_valid( return client_raw_response def date_null( - self, date_query=None, custom_headers={}, raw=False, **operation_config): + self, date_query=None, custom_headers=None, raw=False, **operation_config): """ Get null as date - this should result in no query parameters in uri @@ -1089,7 +1089,7 @@ def date_null( return client_raw_response def date_time_valid( - self, date_time_query, custom_headers={}, raw=False, **operation_config): + self, date_time_query, custom_headers=None, raw=False, **operation_config): """ Get '2012-01-01T01:01:01Z' as date-time @@ -1129,7 +1129,7 @@ def date_time_valid( return client_raw_response def date_time_null( - self, date_time_query=None, custom_headers={}, raw=False, **operation_config): + self, date_time_query=None, custom_headers=None, raw=False, **operation_config): """ Get null as date-time, should result in no query parameters in uri @@ -1170,7 +1170,7 @@ def date_time_null( return client_raw_response def array_string_csv_valid( - self, array_query=None, custom_headers={}, raw=False, **operation_config): + self, array_query=None, custom_headers=None, raw=False, **operation_config): """ Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format @@ -1213,7 +1213,7 @@ def array_string_csv_valid( return client_raw_response def array_string_csv_null( - self, array_query=None, custom_headers={}, raw=False, **operation_config): + self, array_query=None, custom_headers=None, raw=False, **operation_config): """ Get a null array of string using the csv-array format @@ -1254,7 +1254,7 @@ def array_string_csv_null( return client_raw_response def array_string_csv_empty( - self, array_query=None, custom_headers={}, raw=False, **operation_config): + self, array_query=None, custom_headers=None, raw=False, **operation_config): """ Get an empty array [] of string using the csv-array format @@ -1296,7 +1296,7 @@ def array_string_csv_empty( return client_raw_response def array_string_ssv_valid( - self, array_query=None, custom_headers={}, raw=False, **operation_config): + self, array_query=None, custom_headers=None, raw=False, **operation_config): """ Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format @@ -1339,7 +1339,7 @@ def array_string_ssv_valid( return client_raw_response def array_string_tsv_valid( - self, array_query=None, custom_headers={}, raw=False, **operation_config): + self, array_query=None, custom_headers=None, raw=False, **operation_config): """ Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format @@ -1382,7 +1382,7 @@ def array_string_tsv_valid( return client_raw_response def array_string_pipes_valid( - self, array_query=None, custom_headers={}, raw=False, **operation_config): + self, array_query=None, custom_headers=None, raw=False, **operation_config): """ Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format diff --git a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py index 328b2b477650..08b08680cef8 100644 --- a/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py +++ b/AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py @@ -78,7 +78,7 @@ def __init__( def validation_of_method_parameters( - self, resource_group_name, id, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, id, custom_headers=None, raw=False, **operation_config): """ Validates input parameters on the method. See swagger for details. @@ -135,7 +135,7 @@ def validation_of_method_parameters( return deserialized def validation_of_body( - self, resource_group_name, id, body=None, custom_headers={}, raw=False, **operation_config): + self, resource_group_name, id, body=None, custom_headers=None, raw=False, **operation_config): """ Validates body parameters on the method. See swagger for details. @@ -202,7 +202,7 @@ def validation_of_body( return deserialized def get_with_constant_in_path( - self, constant_param="constant", custom_headers={}, raw=False, **operation_config): + self, constant_param="constant", custom_headers=None, raw=False, **operation_config): """ :param constant_param: @@ -244,7 +244,7 @@ def get_with_constant_in_path( return client_raw_response def post_with_constant_in_body( - self, constant_param="constant", body=None, custom_headers={}, raw=False, **operation_config): + self, constant_param="constant", body=None, custom_headers=None, raw=False, **operation_config): """ :param constant_param: diff --git a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs index 3ce192fdbb41..f1c93804a1b8 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs @@ -181,7 +181,7 @@ public virtual string MethodParameterDeclaration(bool addCustomHeaderParameters) if (addCustomHeaderParameters) { - declarations.Add("custom_headers={}"); + declarations.Add("custom_headers=None"); } declarations.Add("raw=False"); From 640df1afc042a452c04a1ca86e26601a6982d5ff Mon Sep 17 00:00:00 2001 From: annatisch Date: Fri, 13 May 2016 15:37:43 -0700 Subject: [PATCH 19/22] Review feedback --- ClientRuntimes/Python/msrest/msrest/serialization.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ClientRuntimes/Python/msrest/msrest/serialization.py b/ClientRuntimes/Python/msrest/msrest/serialization.py index c26596c95659..9dbae75a676d 100644 --- a/ClientRuntimes/Python/msrest/msrest/serialization.py +++ b/ClientRuntimes/Python/msrest/msrest/serialization.py @@ -418,7 +418,7 @@ def serialize_data(self, data, data_type, **kwargs): enum_type = self.dependencies.get(data_type) if enum_type and issubclass(enum_type, Enum): - return self.serialize_enum(data, enum_obj=enum_type, **kwargs) + return Serializer.serialize_enum(data, enum_obj=enum_type) iter_type = data_type[0] + data_type[-1] if iter_type in self.serialize_type: @@ -540,7 +540,8 @@ def serialize_object(self, attr, **kwargs): else: return str(attr) - def serialize_enum(self, attr, enum_obj=None, **kwagrs): + @staticmethod + def serialize_enum(attr, enum_obj=None): try: return attr.value except AttributeError: @@ -728,7 +729,7 @@ def __call__(self, target_obj, response_data): if isinstance(response, basestring): return self.deserialize_data(data, response) - elif issubclass(response, Enum): + elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None: From e0e5bd16c6a879455efcb743bbfb4887f258e1a5 Mon Sep 17 00:00:00 2001 From: annatisch Date: Tue, 17 May 2016 11:03:01 -0700 Subject: [PATCH 20/22] Fixed failed test --- .../Python/Python/TemplateModels/MethodTemplateModel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs index f1c93804a1b8..2c3a051d9c93 100644 --- a/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs +++ b/AutoRest/Generators/Python/Python/TemplateModels/MethodTemplateModel.cs @@ -575,17 +575,17 @@ public string GetDocumentationType(IType type) { result = string.Format(CultureInfo.InvariantCulture, "list of {0}", GetDocumentationType(listType.ElementType)); } - else if (type is EnumType) + else if (enumType != null) { - if (type == ReturnType.Body) + if (enumType == ReturnType.Body) { if (enumType.ModelAsString) result = "str"; else - result = string.Format(CultureInfo.InvariantCulture, ":class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); + result = string.Format(CultureInfo.InvariantCulture, ":class:`{0} <{1}.models.{0}>`", enumType.Name, modelNamespace); } else - result = string.Format(CultureInfo.InvariantCulture, "str or :class:`{0} <{1}.models.{0}>`", type.Name, modelNamespace); + result = string.Format(CultureInfo.InvariantCulture, "str or :class:`{0} <{1}.models.{0}>`", enumType.Name, modelNamespace); } else if (type is DictionaryType) { From 8212eb874607a4b2278cc76d10158783b0032297 Mon Sep 17 00:00:00 2001 From: Vishrut Shah Date: Wed, 18 May 2016 13:14:17 -0700 Subject: [PATCH 21/22] Get formatted reference value for only sequence type or return name (#1051) --- AutoRest/Generators/Ruby/Ruby/ClientModelExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutoRest/Generators/Ruby/Ruby/ClientModelExtensions.cs b/AutoRest/Generators/Ruby/Ruby/ClientModelExtensions.cs index 853c37f8ea7e..d5bd90e7ea0d 100644 --- a/AutoRest/Generators/Ruby/Ruby/ClientModelExtensions.cs +++ b/AutoRest/Generators/Ruby/Ruby/ClientModelExtensions.cs @@ -180,7 +180,7 @@ public static string GetFormattedReferenceValue(this Parameter parameter) SequenceType sequence = parameter.Type as SequenceType; if (sequence == null) { - return parameter.Type.ToString(parameter.Name); + return parameter.Name; } PrimaryType primaryType = sequence.ElementType as PrimaryType; From adee9ea73f4606e08a4a4cc8b7f6961c7d257d66 Mon Sep 17 00:00:00 2001 From: Vishrut Shah Date: Wed, 18 May 2016 14:58:44 -0700 Subject: [PATCH 22/22] Http method get with status code 204 should be success in longrunning operation. (#1056) --- .../lib/ms_rest_azure/azure_service_client.rb | 8 ++++---- .../Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/azure_service_client.rb b/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/azure_service_client.rb index 50f2da8a48b3..afa7016bb7c5 100644 --- a/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/azure_service_client.rb +++ b/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/azure_service_client.rb @@ -36,7 +36,7 @@ def get_long_running_operation_result(azure_response, custom_deserialization_blo elsif !polling_state.location_header_link.nil? update_state_from_location_header(polling_state.get_request(headers: request.headers, base_uri: request.base_uri), polling_state, custom_deserialization_block) elsif http_method === :put - get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, 'get', query_params: request.query_params) + get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, query_params: request.query_params) update_state_from_get_resource_operation(get_request, polling_state, custom_deserialization_block) else task.shutdown @@ -64,7 +64,7 @@ def get_long_running_operation_result(azure_response, custom_deserialization_blo end if (http_method === :put || http_method === :patch) && AsyncOperationStatus.is_successful_status(polling_state.status) && polling_state.resource.nil? - get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, 'get', query_params: request.query_params) + get_request = MsRest::HttpOperationRequest.new(request.base_uri, request.build_path.to_s, :get, query_params: request.query_params) update_state_from_get_resource_operation(get_request, polling_state, custom_deserialization_block) end @@ -154,7 +154,7 @@ def update_state_from_location_header(request, polling_state, custom_deserializa if status_code === 202 polling_state.status = AsyncOperationStatus::IN_PROGRESS_STATUS elsif status_code === 200 || (status_code === 201 && http_method === :put) || - (status_code === 204 && (http_method === :delete || http_method === :post)) + (status_code === 204 && (http_method === :delete || http_method === :post || http_method === :get)) polling_state.status = AsyncOperationStatus::SUCCESS_STATUS error_data = CloudErrorData.new @@ -164,7 +164,7 @@ def update_state_from_location_header(request, polling_state, custom_deserializa polling_state.error_data = error_data polling_state.resource = result.body else - fail AzureOperationError, 'The response from long running operation does not have a valid status code' + fail AzureOperationError, "The response from long running operation does not have a valid status code. Method: #{http_method}, Status Code: #{status_code}" end end diff --git a/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb b/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb index 379243f7c308..a9916ef4edcd 100644 --- a/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb +++ b/ClientRuntimes/Ruby/ms-rest-azure/lib/ms_rest_azure/polling_state.rb @@ -94,7 +94,7 @@ def get_operation_error def get_request(options = {}) link = @azure_async_operation_header_link || @location_header_link - MsRest::HttpOperationRequest.new(nil, link, 'get', options) + MsRest::HttpOperationRequest.new(nil, link, :get, options) end private