From 7d0f902a132535d6a74a8b22b3823f38bd1a829b Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 10 Jun 2022 15:15:47 -0700 Subject: [PATCH 1/6] remove python2 code --- autorest/codegen/__init__.py | 28 +- autorest/codegen/models/base_builder.py | 4 +- autorest/codegen/models/client.py | 2 +- autorest/codegen/models/code_model.py | 19 +- autorest/codegen/models/lro_operation.py | 6 +- .../codegen/models/lro_paging_operation.py | 12 +- autorest/codegen/models/model_type.py | 7 +- autorest/codegen/models/operation.py | 23 +- autorest/codegen/models/operation_group.py | 11 +- autorest/codegen/models/paging_operation.py | 6 +- autorest/codegen/models/parameter.py | 10 +- autorest/codegen/models/parameter_list.py | 56 +- autorest/codegen/serializers/__init__.py | 53 +- .../codegen/serializers/builder_serializer.py | 42 +- .../codegen/serializers/client_serializer.py | 34 +- .../codegen/serializers/general_serializer.py | 9 +- .../codegen/serializers/import_serializer.py | 33 +- .../serializers/metadata_serializer.py | 2 - .../serializers/model_generic_serializer.py | 32 - .../serializers/model_python3_serializer.py | 72 - ...base_serializer.py => model_serializer.py} | 79 +- .../operation_groups_serializer.py | 7 - .../serializers/operations_init_serializer.py | 25 +- .../codegen/serializers/patch_serializer.py | 4 +- .../request_builders_serializer.py | 5 +- autorest/codegen/serializers/utils.py | 5 +- autorest/codegen/templates/client.py.jinja2 | 2 +- autorest/codegen/templates/config.py.jinja2 | 2 +- .../codegen/templates/metadata.json.jinja2 | 8 +- .../codegen/templates/model_init.py.jinja2 | 17 +- .../templates/operation_group.py.jinja2 | 2 +- .../operation_groups_container.py.jinja2 | 6 - autorest/codegen/templates/patch.py.jinja2 | 3 +- .../templates/request_builders.py.jinja2 | 3 - .../codegen/templates/rest_init.py.jinja2 | 11 +- autorest/multiapi/serializers/__init__.py | 11 +- .../multiapi/serializers/import_serializer.py | 12 +- .../sample/_auto_rest_head_test_service.py | 27 +- .../key/credential/sample/_configuration.py | 16 +- .../operations/_http_success_operations.py | 45 +- .../sample/_auto_rest_head_test_service.py | 23 +- .../azure/basic/sample/_configuration.py | 11 +- .../operations/_http_success_operations.py | 45 +- .../azure/directives/sample/_configuration.py | 11 +- .../sample/_polling_paging_example.py | 23 +- .../azure/directives/sample/_vendor.py | 18 + .../azure/directives/sample/aio/_vendor.py | 27 + .../_polling_paging_example_operations.py | 3 +- .../directives/sample/models/__init__.py | 14 +- .../azure/directives/sample/models/_models.py | 120 - .../_polling_paging_example_operations.py | 64 +- .../sample/_auto_rest_head_test_service.py | 24 +- .../azure/mgmt/sample/_configuration.py | 11 +- .../operations/_http_success_operations.py | 45 +- .../azure/multiapi/sample/_configuration.py | 6 +- .../sample/_multiapi_service_client.py | 8 +- .../multiapi/sample/_operations_mixin.py | 47 +- .../multiapi/sample/v1/_configuration.py | 11 +- .../azure/multiapi/sample/v1/_metadata.json | 16 +- .../sample/v1/_multiapi_service_client.py | 22 +- .../azure/multiapi/sample/v1/_vendor.py | 18 + .../azure/multiapi/sample/v1/aio/_vendor.py | 27 + .../_multiapi_service_client_operations.py | 3 +- .../_operation_group_one_operations.py | 1 + .../multiapi/sample/v1/models/__init__.py | 14 +- .../multiapi/sample/v1/models/_models.py | 122 - .../_multiapi_service_client_operations.py | 118 +- .../_operation_group_one_operations.py | 27 +- .../multiapi/sample/v2/_configuration.py | 11 +- .../azure/multiapi/sample/v2/_metadata.json | 8 +- .../sample/v2/_multiapi_service_client.py | 22 +- .../azure/multiapi/sample/v2/_vendor.py | 18 + .../azure/multiapi/sample/v2/aio/_vendor.py | 27 + .../_multiapi_service_client_operations.py | 3 +- .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../multiapi/sample/v2/models/__init__.py | 8 +- .../multiapi/sample/v2/models/_models.py | 74 - .../_multiapi_service_client_operations.py | 55 +- .../_operation_group_one_operations.py | 57 +- .../_operation_group_two_operations.py | 32 +- .../multiapi/sample/v3/_configuration.py | 11 +- .../azure/multiapi/sample/v3/_metadata.json | 8 +- .../sample/v3/_multiapi_service_client.py | 22 +- .../azure/multiapi/sample/v3/_vendor.py | 18 + .../azure/multiapi/sample/v3/aio/_vendor.py | 27 + .../_multiapi_service_client_operations.py | 3 +- .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../multiapi/sample/v3/models/__init__.py | 14 +- .../multiapi/sample/v3/models/_models.py | 118 - .../_multiapi_service_client_operations.py | 50 +- .../_operation_group_one_operations.py | 47 +- .../_operation_group_two_operations.py | 57 +- .../bodyduration/models/__init__.py | 1 - .../azureparametergrouping/models/__init__.py | 1 - .../azurereport/models/__init__.py | 1 - .../azurespecialproperties/models/__init__.py | 1 - .../custombaseurl/models/__init__.py | 1 - .../custompollerpager/models/__init__.py | 1 - .../operations/_paging_operations.py | 1 + .../custombaseurlpaging/models/__init__.py | 1 - .../Lro/lro/models/__init__.py | 1 - .../models/__init__.py | 1 - .../customize/_auto_rest_head_test_service.py | 23 +- .../packagemode/customize/_configuration.py | 11 +- .../operations/_http_success_operations.py | 64 +- .../dataplane/_auto_rest_head_test_service.py | 23 +- .../packagemode/dataplane/_configuration.py | 11 +- .../operations/_http_success_operations.py | 64 +- .../mode/_auto_rest_head_test_service.py | 23 +- .../azure/package/mode/_configuration.py | 11 +- .../operations/_http_success_operations.py | 64 +- .../Paging/paging/models/__init__.py | 1 - .../storage/models/__init__.py | 1 - .../models/__init__.py | 1 - .../bodydurationlowlevel/_client.py | 1 - .../rest/duration/__init__.py | 14 +- .../rest/duration/_request_builders.py | 71 +- .../rest/duration/_request_builders_py3.py | 154 - .../azureparametergroupinglowlevel/_client.py | 1 - .../rest/parameter_grouping/__init__.py | 20 +- .../parameter_grouping/_request_builders.py | 159 +- .../_request_builders_py3.py | 319 -- .../azurereportlowlevel/_client.py | 1 - .../azurereportlowlevel/rest/__init__.py | 5 +- .../rest/_request_builders.py | 23 +- .../rest/_request_builders_py3.py | 61 - .../azurespecialpropertieslowlevel/_client.py | 1 - .../rest/api_version_default/__init__.py | 14 +- .../api_version_default/_request_builders.py | 87 +- .../_request_builders_py3.py | 169 - .../rest/api_version_local/__init__.py | 14 +- .../api_version_local/_request_builders.py | 86 +- .../_request_builders_py3.py | 184 - .../rest/header/__init__.py | 11 +- .../rest/header/_request_builders.py | 60 +- .../rest/header/_request_builders_py3.py | 129 - .../rest/odata/__init__.py | 5 +- .../rest/odata/_request_builders.py | 27 +- .../rest/odata/_request_builders_py3.py | 70 - .../rest/skip_url_encoding/__init__.py | 23 +- .../skip_url_encoding/_request_builders.py | 142 +- .../_request_builders_py3.py | 306 -- .../subscription_in_credentials/__init__.py | 17 +- .../_request_builders.py | 107 +- .../_request_builders_py3.py | 234 -- .../rest/subscription_in_method/__init__.py | 14 +- .../_request_builders.py | 79 +- .../_request_builders_py3.py | 186 - .../rest/xms_client_request_id/__init__.py | 8 +- .../_request_builders.py | 33 +- .../_request_builders_py3.py | 81 - .../rest/paths/__init__.py | 5 +- .../rest/paths/_request_builders.py | 19 +- .../rest/paths/_request_builders_py3.py | 49 - .../rest/paging/__init__.py | 11 +- .../rest/paging/_request_builders.py | 54 +- .../rest/paging/_request_builders_py3.py | 123 - .../headexceptionslowlevel/_client.py | 1 - .../rest/head_exception/__init__.py | 11 +- .../rest/head_exception/_request_builders.py | 34 +- .../head_exception/_request_builders_py3.py | 88 - .../HeadLowLevel/headlowlevel/_client.py | 1 - .../rest/http_success/__init__.py | 11 +- .../rest/http_success/_request_builders.py | 34 +- .../http_success/_request_builders_py3.py | 88 - .../LroLowLevel/lrolowlevel/_client.py | 1 - .../rest/lr_os_custom_header/__init__.py | 14 +- .../lr_os_custom_header/_request_builders.py | 123 +- .../_request_builders_py3.py | 489 --- .../lrolowlevel/rest/lro_retrys/__init__.py | 23 +- .../rest/lro_retrys/_request_builders.py | 171 +- .../rest/lro_retrys/_request_builders_py3.py | 577 --- .../lrolowlevel/rest/lros/__init__.py | 134 +- .../rest/lros/_request_builders.py | 1085 ++--- .../rest/lros/_request_builders_py3.py | 3580 ----------------- .../lrolowlevel/rest/lrosads/__init__.py | 80 +- .../rest/lrosads/_request_builders.py | 671 +-- .../rest/lrosads/_request_builders_py3.py | 2292 ----------- .../rest/__init__.py | 8 +- .../rest/_request_builders.py | 39 +- .../rest/_request_builders_py3.py | 91 - .../PagingLowLevel/paginglowlevel/_client.py | 1 - .../paginglowlevel/rest/paging/__init__.py | 65 +- .../rest/paging/_request_builders.py | 440 +- .../rest/paging/_request_builders_py3.py | 888 ---- .../storagelowlevel/_client.py | 1 - .../rest/storage_accounts/__init__.py | 29 +- .../storage_accounts/_request_builders.py | 383 +- .../storage_accounts/_request_builders_py3.py | 927 ----- .../storagelowlevel/rest/usage/__init__.py | 5 +- .../rest/usage/_request_builders.py | 25 +- .../rest/usage/_request_builders_py3.py | 65 - .../_client.py | 1 - .../rest/group/__init__.py | 5 +- .../rest/group/_request_builders.py | 28 +- .../rest/group/_request_builders_py3.py | 68 - .../bodydurationversiontolerant/_client.py | 1 - .../_client.py | 1 - .../azurereportversiontolerant/_client.py | 1 - .../_client.py | 1 - .../_client.py | 1 - .../headexceptionsversiontolerant/_client.py | 1 - .../headversiontolerant/_client.py | 1 - .../lroversiontolerant/_client.py | 1 - .../pagingversiontolerant/_client.py | 1 - .../storageversiontolerant/_client.py | 1 - .../_client.py | 1 - .../_client.py | 1 - .../rest/__init__.py | 14 +- .../rest/_request_builders.py | 101 +- .../rest/_request_builders_py3.py | 273 -- .../_client.py | 1 - .../rest/__init__.py | 14 +- .../rest/_request_builders.py | 101 +- .../rest/_request_builders_py3.py | 273 -- .../_client.py | 1 - .../rest/params/__init__.py | 17 +- .../rest/params/_request_builders.py | 112 +- .../rest/params/_request_builders_py3.py | 290 -- .../_client.py | 1 - .../rest/params/__init__.py | 23 +- .../rest/params/_request_builders.py | 152 +- .../rest/params/_request_builders_py3.py | 375 -- .../_client.py | 1 - .../_client.py | 1 - .../_client.py | 1 - .../_client.py | 1 - .../dpgtestmodelsversiontolerant/_client.py | 1 - .../models/__init__.py | 1 - .../Multiapi/multiapi/_configuration.py | 6 +- .../multiapi/_multiapi_service_client.py | 8 +- .../Multiapi/multiapi/_operations_mixin.py | 47 +- .../Multiapi/multiapi/v0/_metadata.json | 4 +- .../Multiapi/multiapi/v0/models/__init__.py | 1 - .../_operation_group_one_operations.py | 1 + .../Multiapi/multiapi/v1/_metadata.json | 16 +- .../Multiapi/multiapi/v1/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../Multiapi/multiapi/v2/_metadata.json | 8 +- .../Multiapi/multiapi/v2/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../Multiapi/multiapi/v3/_metadata.json | 8 +- .../Multiapi/multiapi/v3/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../_configuration.py | 11 +- .../_multiapi_service_client.py | 13 +- .../_operations_mixin.py | 47 +- .../v1/_metadata.json | 16 +- .../v1/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../v2/_metadata.json | 8 +- .../v2/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../v3/_metadata.json | 8 +- .../v3/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../multiapicustombaseurl/_configuration.py | 8 +- ...multiapi_custom_base_url_service_client.py | 8 +- .../_operations_mixin.py | 13 +- .../multiapicustombaseurl/v1/_metadata.json | 6 +- .../v1/models/__init__.py | 1 - ...stom_base_url_service_client_operations.py | 1 + .../multiapicustombaseurl/v2/_metadata.json | 6 +- .../v2/models/__init__.py | 1 - ...stom_base_url_service_client_operations.py | 1 + .../multiapidataplane/_configuration.py | 6 +- .../_multiapi_service_client.py | 8 +- .../multiapidataplane/_operations_mixin.py | 47 +- .../multiapidataplane/v1/_metadata.json | 16 +- .../multiapidataplane/v1/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../multiapidataplane/v2/_metadata.json | 8 +- .../multiapidataplane/v2/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../multiapidataplane/v3/_metadata.json | 8 +- .../multiapidataplane/v3/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../multiapinoasync/_configuration.py | 6 +- .../_multiapi_service_client.py | 8 +- .../multiapinoasync/_operations_mixin.py | 47 +- .../multiapinoasync/v1/_metadata.json | 16 +- .../multiapinoasync/v1/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../multiapinoasync/v2/_metadata.json | 8 +- .../multiapinoasync/v2/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../multiapinoasync/v3/_metadata.json | 8 +- .../multiapinoasync/v3/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../multiapisecurity/_configuration.py | 6 +- .../_multiapi_service_client.py | 8 +- .../multiapisecurity/_operations_mixin.py | 38 +- .../multiapisecurity/v0/_metadata.json | 4 +- .../multiapisecurity/v0/models/__init__.py | 1 - .../_operation_group_one_operations.py | 1 + .../multiapisecurity/v1/_metadata.json | 16 +- .../multiapisecurity/v1/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../submodule/_configuration.py | 6 +- .../submodule/_multiapi_service_client.py | 8 +- .../submodule/_operations_mixin.py | 47 +- .../submodule/v1/_metadata.json | 16 +- .../submodule/v1/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../submodule/v2/_metadata.json | 8 +- .../submodule/v2/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../submodule/v3/_metadata.json | 8 +- .../submodule/v3/models/__init__.py | 1 - .../_multiapi_service_client_operations.py | 1 + .../_operation_group_one_operations.py | 1 + .../_operation_group_two_operations.py | 1 + .../additionalproperties/models/__init__.py | 1 - .../BodyArray/bodyarray/models/__init__.py | 1 - .../vanilla/body/array/models/__init__.py | 1 - .../models/__init__.py | 1 - .../bodyboolean/models/__init__.py | 1 - .../BodyByte/bodybyte/models/__init__.py | 1 - .../models/__init__.py | 1 - .../bodycomplex/models/__init__.py | 1 - .../BodyDate/bodydate/models/__init__.py | 1 - .../bodydatetime/models/__init__.py | 1 - .../bodydatetimerfc1123/models/__init__.py | 1 - .../bodydictionary/models/__init__.py | 1 - .../bodyduration/models/__init__.py | 1 - .../BodyFile/bodyfile/models/__init__.py | 1 - .../bodyformdata/models/__init__.py | 1 - .../bodyformurlencodeddata/models/__init__.py | 1 - .../bodyinteger/models/__init__.py | 1 - .../BodyNumber/bodynumber/models/__init__.py | 1 - .../BodyString/bodystring/models/__init__.py | 1 - .../BodyTime/bodytime/models/__init__.py | 1 - .../Constants/constants/models/__init__.py | 1 - .../custombaseurl/models/__init__.py | 1 - .../models/__init__.py | 1 - .../errorwithsecrets/models/__init__.py | 1 - .../extensibleenumsswagger/models/__init__.py | 1 - .../Header/header/models/__init__.py | 1 - .../httpinfrastructure/models/__init__.py | 1 - .../incorrecterrorresponse/models/__init__.py | 1 - .../MediaTypes/mediatypes/models/__init__.py | 1 - .../modelflattening/models/__init__.py | 1 - .../multipleinheritance/models/__init__.py | 1 - .../nooperations/models/__init__.py | 1 - .../nonstringenums/models/__init__.py | 1 - .../packagemode/_anything_client.py | 21 +- .../packagemode/_configuration.py | 11 +- .../packagemode/_vendor.py | 20 + .../packagemode/aio/_vendor.py | 28 + .../operations/_anything_client_operations.py | 3 +- .../operations/_anything_client_operations.py | 150 +- .../parameterflattening/models/__init__.py | 1 - .../Report/report/models/__init__.py | 1 - .../requiredoptional/models/__init__.py | 1 - .../reservedwords/models/__init__.py | 1 - .../Url/url/models/__init__.py | 1 - .../models/__init__.py | 1 - .../Validation/validation/models/__init__.py | 1 - .../Xml/xmlservice/models/__init__.py | 1 - .../xmserrorresponse/models/__init__.py | 1 - .../additionalpropertieslowlevel/_client.py | 1 - .../rest/pets/__init__.py | 20 +- .../rest/pets/_request_builders.py | 183 +- .../rest/pets/_request_builders_py3.py | 617 --- .../anythinglowlevel/_client.py | 1 - .../anythinglowlevel/rest/__init__.py | 20 +- .../rest/_request_builders.py | 99 +- .../rest/_request_builders_py3.py | 228 -- .../bodyarraylowlevel/_client.py | 1 - .../bodyarraylowlevel/rest/array/__init__.py | 209 +- .../rest/array/_request_builders.py | 1359 ++----- .../rest/array/_request_builders_py3.py | 3421 ---------------- .../bodybinarylowlevel/_client.py | 1 - .../rest/upload/__init__.py | 8 +- .../rest/upload/_request_builders.py | 35 +- .../rest/upload/_request_builders_py3.py | 91 - .../bodybooleanlowlevel/_client.py | 1 - .../bodybooleanlowlevel/rest/bool/__init__.py | 20 +- .../rest/bool/_request_builders.py | 125 +- .../rest/bool/_request_builders_py3.py | 225 -- .../bodybytelowlevel/_client.py | 1 - .../bodybytelowlevel/rest/byte/__init__.py | 17 +- .../rest/byte/_request_builders.py | 87 +- .../rest/byte/_request_builders_py3.py | 186 - .../bodycomplexlowlevel/_client.py | 1 - .../rest/array/__init__.py | 17 +- .../rest/array/_request_builders.py | 111 +- .../rest/array/_request_builders_py3.py | 319 -- .../rest/basic/__init__.py | 20 +- .../rest/basic/_request_builders.py | 124 +- .../rest/basic/_request_builders_py3.py | 291 -- .../rest/dictionary/__init__.py | 20 +- .../rest/dictionary/_request_builders.py | 127 +- .../rest/dictionary/_request_builders_py3.py | 352 -- .../rest/flattencomplex/__init__.py | 5 +- .../rest/flattencomplex/_request_builders.py | 19 +- .../flattencomplex/_request_builders_py3.py | 49 - .../rest/inheritance/__init__.py | 8 +- .../rest/inheritance/_request_builders.py | 49 +- .../rest/inheritance/_request_builders_py3.py | 169 - .../rest/polymorphicrecursive/__init__.py | 8 +- .../polymorphicrecursive/_request_builders.py | 49 +- .../_request_builders_py3.py | 362 -- .../rest/polymorphism/__init__.py | 29 +- .../rest/polymorphism/_request_builders.py | 203 +- .../polymorphism/_request_builders_py3.py | 889 ---- .../rest/primitive/__init__.py | 68 +- .../rest/primitive/_request_builders.py | 509 +-- .../rest/primitive/_request_builders_py3.py | 1458 ------- .../rest/readonlyproperty/__init__.py | 8 +- .../readonlyproperty/_request_builders.py | 49 +- .../readonlyproperty/_request_builders_py3.py | 153 - .../bodydatelowlevel/_client.py | 1 - .../bodydatelowlevel/rest/date/__init__.py | 26 +- .../rest/date/_request_builders.py | 139 +- .../rest/date/_request_builders_py3.py | 290 -- .../bodydatetimelowlevel/_client.py | 1 - .../rest/datetime/__init__.py | 68 +- .../rest/datetime/_request_builders.py | 383 +- .../rest/datetime/_request_builders_py3.py | 784 ---- .../bodydatetimerfc1123lowlevel/_client.py | 1 - .../rest/datetimerfc1123/__init__.py | 29 +- .../rest/datetimerfc1123/_request_builders.py | 155 +- .../datetimerfc1123/_request_builders_py3.py | 322 -- .../bodydictionarylowlevel/_client.py | 1 - .../rest/dictionary/__init__.py | 197 +- .../rest/dictionary/_request_builders.py | 1253 ++---- .../rest/dictionary/_request_builders_py3.py | 3106 -------------- .../bodydurationlowlevel/_client.py | 1 - .../rest/duration/__init__.py | 14 +- .../rest/duration/_request_builders.py | 71 +- .../rest/duration/_request_builders_py3.py | 154 - .../bodyfilelowlevel/_client.py | 1 - .../bodyfilelowlevel/rest/files/__init__.py | 11 +- .../rest/files/_request_builders.py | 51 +- .../rest/files/_request_builders_py3.py | 113 - .../bodyformdatalowlevel/_client.py | 1 - .../rest/formdata/__init__.py | 11 +- .../rest/formdata/_request_builders.py | 63 +- .../rest/formdata/_request_builders_py3.py | 143 - .../bodyformurlencodeddatalowlevel/_client.py | 1 - .../rest/formdataurlencoded/__init__.py | 8 +- .../formdataurlencoded/_request_builders.py | 38 +- .../_request_builders_py3.py | 109 - .../bodyintegerlowlevel/_client.py | 1 - .../bodyintegerlowlevel/rest/int/__init__.py | 44 +- .../rest/int/_request_builders.py | 247 +- .../rest/int/_request_builders_py3.py | 506 --- .../bodynumberlowlevel/_client.py | 1 - .../rest/number/__init__.py | 74 +- .../rest/number/_request_builders.py | 463 +-- .../rest/number/_request_builders_py3.py | 865 ---- .../bodystringlowlevel/_client.py | 1 - .../bodystringlowlevel/rest/enum/__init__.py | 20 +- .../rest/enum/_request_builders.py | 121 +- .../rest/enum/_request_builders_py3.py | 300 -- .../rest/string/__init__.py | 41 +- .../rest/string/_request_builders.py | 260 +- .../rest/string/_request_builders_py3.py | 479 --- .../bodytimelowlevel/_client.py | 1 - .../bodytimelowlevel/rest/time/__init__.py | 8 +- .../rest/time/_request_builders.py | 39 +- .../rest/time/_request_builders_py3.py | 90 - .../constantslowlevel/_client.py | 1 - .../rest/contants/__init__.py | 53 +- .../rest/contants/_request_builders.py | 270 +- .../rest/contants/_request_builders_py3.py | 658 --- .../rest/paths/__init__.py | 5 +- .../rest/paths/_request_builders.py | 19 +- .../rest/paths/_request_builders_py3.py | 49 - .../rest/paths/__init__.py | 5 +- .../rest/paths/_request_builders.py | 27 +- .../rest/paths/_request_builders_py3.py | 72 - .../errorwithsecretslowlevel/_client.py | 1 - .../errorwithsecretslowlevel/rest/__init__.py | 8 +- .../rest/_request_builders.py | 35 +- .../rest/_request_builders_py3.py | 81 - .../extensibleenumsswaggerlowlevel/_client.py | 1 - .../rest/pet/__init__.py | 8 +- .../rest/pet/_request_builders.py | 52 +- .../rest/pet/_request_builders_py3.py | 165 - .../HeaderLowLevel/headerlowlevel/_client.py | 1 - .../headerlowlevel/rest/header/__init__.py | 89 +- .../rest/header/_request_builders.py | 636 +-- .../rest/header/_request_builders_py3.py | 1164 ------ .../httpinfrastructurelowlevel/_client.py | 1 - .../rest/http_client_failure/__init__.py | 80 +- .../http_client_failure/_request_builders.py | 471 +-- .../_request_builders_py3.py | 966 ----- .../rest/http_failure/__init__.py | 11 +- .../rest/http_failure/_request_builders.py | 51 +- .../http_failure/_request_builders_py3.py | 113 - .../rest/http_redirects/__init__.py | 50 +- .../rest/http_redirects/_request_builders.py | 287 +- .../http_redirects/_request_builders_py3.py | 595 --- .../rest/http_retry/__init__.py | 29 +- .../rest/http_retry/_request_builders.py | 171 +- .../rest/http_retry/_request_builders_py3.py | 359 -- .../rest/http_server_failure/__init__.py | 14 +- .../http_server_failure/_request_builders.py | 75 +- .../_request_builders_py3.py | 163 - .../rest/http_success/__init__.py | 59 +- .../rest/http_success/_request_builders.py | 363 +- .../http_success/_request_builders_py3.py | 751 ---- .../rest/multiple_responses/__init__.py | 104 +- .../multiple_responses/_request_builders.py | 507 +-- .../_request_builders_py3.py | 1042 ----- .../incorrecterrorresponselowlevel/_client.py | 1 - .../rest/__init__.py | 5 +- .../rest/_request_builders.py | 12 +- .../rest/_request_builders_py3.py | 41 - .../mediatypeslowlevel/_client.py | 1 - .../mediatypeslowlevel/rest/__init__.py | 20 +- .../rest/_request_builders.py | 139 +- .../rest/_request_builders_py3.py | 381 -- .../mergepatchjsonlowlevel/_client.py | 1 - .../mergepatchjsonlowlevel/rest/__init__.py | 5 +- .../rest/_request_builders.py | 23 +- .../rest/_request_builders_py3.py | 64 - .../modelflatteninglowlevel/_client.py | 1 - .../modelflatteninglowlevel/rest/__init__.py | 35 +- .../rest/_request_builders.py | 282 +- .../rest/_request_builders_py3.py | 976 ----- .../multipleinheritancelowlevel/_client.py | 1 - .../rest/__init__.py | 32 +- .../rest/_request_builders.py | 233 +- .../rest/_request_builders_py3.py | 685 ---- .../nonstringenumslowlevel/_client.py | 1 - .../rest/float/__init__.py | 8 +- .../rest/float/_request_builders.py | 39 +- .../rest/float/_request_builders_py3.py | 90 - .../rest/int/__init__.py | 8 +- .../rest/int/_request_builders.py | 39 +- .../rest/int/_request_builders_py3.py | 90 - .../objecttypelowlevel/_client.py | 1 - .../objecttypelowlevel/rest/__init__.py | 8 +- .../rest/_request_builders.py | 39 +- .../rest/_request_builders_py3.py | 98 - .../parameterflatteninglowlevel/_client.py | 1 - .../rest/availability_sets/__init__.py | 5 +- .../availability_sets/_request_builders.py | 39 +- .../_request_builders_py3.py | 144 - .../rest/__init__.py | 5 +- .../rest/_request_builders.py | 12 +- .../rest/_request_builders_py3.py | 40 - .../ReportLowLevel/reportlowlevel/_client.py | 1 - .../reportlowlevel/rest/__init__.py | 8 +- .../reportlowlevel/rest/_request_builders.py | 43 +- .../rest/_request_builders_py3.py | 105 - .../requiredoptionallowlevel/_client.py | 1 - .../rest/explicit/__init__.py | 74 +- .../rest/explicit/_request_builders.py | 597 +-- .../rest/explicit/_request_builders_py3.py | 1676 -------- .../rest/implicit/__init__.py | 26 +- .../rest/implicit/_request_builders.py | 166 +- .../rest/implicit/_request_builders_py3.py | 341 -- .../reservedwordslowlevel/_client.py | 1 - .../reservedwordslowlevel/rest/__init__.py | 17 +- .../rest/_request_builders.py | 111 +- .../rest/_request_builders_py3.py | 241 -- .../rest/import_operations/__init__.py | 5 +- .../import_operations/_request_builders.py | 23 +- .../_request_builders_py3.py | 58 - .../securityaadswaggerlowlevel/_client.py | 1 - .../rest/__init__.py | 5 +- .../rest/_request_builders.py | 12 +- .../rest/_request_builders_py3.py | 40 - .../securitykeyswaggerlowlevel/_client.py | 1 - .../rest/__init__.py | 5 +- .../rest/_request_builders.py | 12 +- .../rest/_request_builders_py3.py | 40 - .../UrlLowLevel/urllowlevel/_client.py | 1 - .../urllowlevel/rest/path_items/__init__.py | 14 +- .../rest/path_items/_request_builders.py | 171 +- .../rest/path_items/_request_builders_py3.py | 309 -- .../urllowlevel/rest/paths/__init__.py | 83 +- .../rest/paths/_request_builders.py | 537 +-- .../rest/paths/_request_builders_py3.py | 1126 ------ .../urllowlevel/rest/queries/__init__.py | 107 +- .../rest/queries/_request_builders.py | 721 +--- .../rest/queries/_request_builders_py3.py | 1488 ------- .../_client.py | 1 - .../rest/queries/__init__.py | 11 +- .../rest/queries/_request_builders.py | 69 +- .../rest/queries/_request_builders_py3.py | 147 - .../validationlowlevel/_client.py | 1 - .../validationlowlevel/rest/__init__.py | 14 +- .../rest/_request_builders.py | 154 +- .../rest/_request_builders_py3.py | 405 -- .../XmlLowLevel/xmlservicelowlevel/_client.py | 1 - .../xmlservicelowlevel/rest/xml/__init__.py | 104 +- .../rest/xml/_request_builders.py | 618 +-- .../rest/xml/_request_builders_py3.py | 1585 -------- .../xmserrorresponselowlevel/_client.py | 1 - .../rest/pet/__init__.py | 11 +- .../rest/pet/_request_builders.py | 61 +- .../rest/pet/_request_builders_py3.py | 142 - .../_client.py | 1 - .../anythingversiontolerant/_client.py | 1 - .../bodyarrayversiontolerant/_client.py | 1 - .../bodybinaryversiontolerant/_client.py | 1 - .../bodybooleanversiontolerant/_client.py | 1 - .../bodybyteversiontolerant/_client.py | 1 - .../bodycomplexversiontolerant/_client.py | 1 - .../_client.py | 1 - .../bodydatetimeversiontolerant/_client.py | 1 - .../bodydateversiontolerant/_client.py | 1 - .../bodydictionaryversiontolerant/_client.py | 1 - .../bodydurationversiontolerant/_client.py | 1 - .../bodyfileversiontolerant/_client.py | 1 - .../bodyformdataversiontolerant/_client.py | 1 - .../_client.py | 1 - .../bodyintegerversiontolerant/_client.py | 1 - .../bodynumberversiontolerant/_client.py | 1 - .../bodystringversiontolerant/_client.py | 1 - .../bodytimeversiontolerant/_client.py | 1 - .../constantsversiontolerant/_client.py | 1 - .../_client.py | 1 - .../_client.py | 1 - .../headerversiontolerant/_client.py | 1 - .../_client.py | 1 - .../_client.py | 1 - .../mediatypesversiontolerant/_client.py | 1 - .../mergepatchjsonversiontolerant/_client.py | 1 - .../modelflatteningversiontolerant/_client.py | 1 - .../_client.py | 1 - .../nonstringenumsversiontolerant/_client.py | 1 - .../objecttypeversiontolerant/_client.py | 1 - .../_client.py | 1 - .../reportversiontolerant/_client.py | 1 - .../_client.py | 1 - .../reservedwordsversiontolerant/_client.py | 1 - .../_client.py | 1 - .../_client.py | 1 - .../_client.py | 1 - .../urlversiontolerant/_client.py | 1 - .../validationversiontolerant/_client.py | 1 - .../xmlserviceversiontolerant/_client.py | 1 - .../_client.py | 1 - 665 files changed, 7255 insertions(+), 62159 deletions(-) delete mode 100644 autorest/codegen/serializers/model_generic_serializer.py delete mode 100644 autorest/codegen/serializers/model_python3_serializer.py rename autorest/codegen/serializers/{model_base_serializer.py => model_serializer.py} (69%) create mode 100644 docs/samples/specification/directives/generated/azure/directives/sample/aio/_vendor.py delete mode 100644 docs/samples/specification/directives/generated/azure/directives/sample/models/_models.py create mode 100644 docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_vendor.py delete mode 100644 docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/models/_models.py create mode 100644 docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_vendor.py delete mode 100644 docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/models/_models.py create mode 100644 docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_vendor.py delete mode 100644 docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/_models.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py delete mode 100644 test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders_py3.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/_request_builders_py3.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/_request_builders_py3.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/_request_builders_py3.py delete mode 100644 test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py create mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_vendor.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py delete mode 100644 test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders_py3.py diff --git a/autorest/codegen/__init__.py b/autorest/codegen/__init__.py index b4d5d0f33d0..5ee34ce00ca 100644 --- a/autorest/codegen/__init__.py +++ b/autorest/codegen/__init__.py @@ -57,13 +57,6 @@ def _validate_code_model_options(options: Dict[str, Any]) -> None: "to 'public' or 'hidden'." ) - if not options["show_operations"] and options["add_python3_operation_files"]: - raise ValueError( - "Can not add typed sync operation files if you are not showing operations. " - "If you want typed synced operation files, you have to add flag " - "--show-operations" - ) - if options["basic_setup_py"] and not options["package_version"]: raise ValueError("--basic-setup-py must be used with --package-version") @@ -197,12 +190,16 @@ def _build_code_model_options(self) -> Dict[str, Any]: models_mode_default = ( "none" if low_level_client or version_tolerant else "msrest" ) - python3_only = cast( - bool, - self._autorestapi.get_boolean_value( - "python3-only", low_level_client or version_tolerant - ), - ) + if self._autorestapi.get_boolean_value("python3-only") is False: + _LOGGER.warning( + "You have passed in --python3-only=False. We have force overriden " + "this to True." + ) + if self._autorestapi.get_boolean_value("add-python3-operation-files"): + _LOGGER.warning( + "You have passed in --add-python3-operation-files. " + "This flag no longer has an effect bc all SDKs are now Python3 only." + ) options: Dict[str, Any] = { "azure_arm": azure_arm, @@ -241,16 +238,11 @@ def _build_code_model_options(self) -> Dict[str, Any]: "only-path-and-body-params-positional", low_level_client or version_tolerant, ), - "add_python3_operation_files": self._autorestapi.get_boolean_value( - "add-python3-operation-files", - python3_only and not (low_level_client or version_tolerant), - ), "version_tolerant": version_tolerant, "low_level_client": low_level_client, "combine_operation_files": self._autorestapi.get_boolean_value( "combine-operation-files", version_tolerant ), - "python3_only": python3_only, "package_mode": self._autorestapi.get_value("package-mode"), "package_pprint_name": self._autorestapi.get_value("package-pprint-name"), "package_configuration": self._autorestapi.get_value( diff --git a/autorest/codegen/models/base_builder.py b/autorest/codegen/models/base_builder.py index 998bbdac122..17d7bc851fd 100644 --- a/autorest/codegen/models/base_builder.py +++ b/autorest/codegen/models/base_builder.py @@ -89,7 +89,7 @@ def description(self) -> str: ) return self._description or self.name - def method_signature(self, is_python3_file: bool, async_mode: bool) -> List[str]: + def method_signature(self, async_mode: bool) -> List[str]: if self.abstract: return ["*args,", "**kwargs"] - return self.parameters.method_signature(is_python3_file, async_mode) + return self.parameters.method_signature(async_mode) diff --git a/autorest/codegen/models/client.py b/autorest/codegen/models/client.py index 602d4435357..9a127e52884 100644 --- a/autorest/codegen/models/client.py +++ b/autorest/codegen/models/client.py @@ -159,7 +159,7 @@ def imports(self, async_mode: bool) -> FileImport: # Also in this case, we're in version tolerant, so python3 only is true file_import.add_submodule_import( f"{path_to_models}models", - f"{self.code_model.get_models_filename(is_python3_file=True)}", + self.code_model.models_filename, ImportType.LOCAL, alias="models", ) diff --git a/autorest/codegen/models/code_model.py b/autorest/codegen/models/code_model.py index 72937636427..b2333a944b7 100644 --- a/autorest/codegen/models/code_model.py +++ b/autorest/codegen/models/code_model.py @@ -235,11 +235,7 @@ def need_format_url(self) -> bool: @property def need_mixin_abc(self) -> bool: """Do we want a mixin ABC class for typing purposes?""" - return any( - o - for o in self.operation_groups - if o.is_mixin and self.options["python3_only"] - ) + return any(o for o in self.operation_groups if o.is_mixin) @property def has_lro_operations(self) -> bool: @@ -252,20 +248,19 @@ def has_lro_operations(self) -> bool: ] ) - def get_models_filename(self, is_python3_file: bool) -> str: + @property + def models_filename(self) -> str: """Get the names of the model file(s)""" - if not self.is_legacy and self.options["python3_only"]: - return "_models" - if is_python3_file: + if self.is_legacy: return "_models_py3" return "_models" @property def enums_filename(self) -> str: """The name of the enums file""" - if not self.is_legacy: - return "_enums" - return f"_{self.module_name}_enums" + if self.is_legacy: + return f"_{self.module_name}_enums" + return "_enums" @property def is_legacy(self) -> bool: diff --git a/autorest/codegen/models/lro_operation.py b/autorest/codegen/models/lro_operation.py index 49043170c77..cffd3b94b7d 100644 --- a/autorest/codegen/models/lro_operation.py +++ b/autorest/codegen/models/lro_operation.py @@ -120,10 +120,8 @@ def get_base_polling_method_path(self, async_mode: bool) -> str: def get_no_polling_method(self, async_mode: bool) -> str: return self.responses[0].get_no_polling_method(async_mode) - def imports( - self, async_mode: bool, is_python3_file: bool, **kwargs: Any - ) -> FileImport: - file_import = super().imports(async_mode, is_python3_file, **kwargs) + def imports(self, async_mode: bool, **kwargs: Any) -> FileImport: + file_import = super().imports(async_mode, **kwargs) if self.abstract: return file_import if async_mode: diff --git a/autorest/codegen/models/lro_paging_operation.py b/autorest/codegen/models/lro_paging_operation.py index 5897c95d08a..d663a37e317 100644 --- a/autorest/codegen/models/lro_paging_operation.py +++ b/autorest/codegen/models/lro_paging_operation.py @@ -25,15 +25,9 @@ def operation_type(self) -> str: def cls_type_annotation(self, *, async_mode: bool) -> str: return f"ClsType[{Response.type_annotation(self.responses[0], async_mode=async_mode)}]" # pylint: disable=no-member - def imports( - self, async_mode: bool, is_python3_file: bool, **kwargs: Any - ) -> FileImport: - lro_imports = LROOperationBase.imports( - self, async_mode, is_python3_file, **kwargs - ) - paging_imports = PagingOperationBase.imports( - self, async_mode, is_python3_file, **kwargs - ) + def imports(self, async_mode: bool, **kwargs: Any) -> FileImport: + lro_imports = LROOperationBase.imports(self, async_mode, **kwargs) + paging_imports = PagingOperationBase.imports(self, async_mode, **kwargs) file_import = lro_imports file_import.merge(paging_imports) diff --git a/autorest/codegen/models/model_type.py b/autorest/codegen/models/model_type.py index 97b7fd317d9..4fe31a4965a 100644 --- a/autorest/codegen/models/model_type.py +++ b/autorest/codegen/models/model_type.py @@ -238,13 +238,8 @@ def imports(self, **kwargs: Any) -> FileImport: relative_path, "models", ImportType.LOCAL, alias="_models" ) else: - # a little hacky, but we only do this for version tolerant - # models files, which are all python3 only - models_filename = self.code_model.get_models_filename( - is_python3_file=True - ) file_import.add_submodule_import( - f"{relative_path}models.{models_filename}", + f"{relative_path}models.{self.code_model.models_filename}", self.name, ImportType.LOCAL, ) diff --git a/autorest/codegen/models/operation.py b/autorest/codegen/models/operation.py index 9881101c06d..5e88b1b611f 100644 --- a/autorest/codegen/models/operation.py +++ b/autorest/codegen/models/operation.py @@ -274,22 +274,14 @@ def get_request_builder_import( alias="rest", ) if self.code_model.options["builders_visibility"] == "embedded" and async_mode: - suffix = ( - "_py3" - if self.code_model.options["add_python3_operation_files"] - and not self.code_model.options["python3_only"] - else "" - ) file_import.add_submodule_import( - f"...{self.code_model.operations_folder_name}.{self.filename}{suffix}", + f"...{self.code_model.operations_folder_name}.{self.filename}", request_builder.name, import_type=ImportType.LOCAL, ) return file_import - def imports( - self, async_mode: bool, is_python3_file: bool, **kwargs: Any - ) -> FileImport: + def imports(self, async_mode: bool, **kwargs: Any) -> FileImport: if self.abstract: return FileImport() file_import = self._imports_shared(async_mode, **kwargs) @@ -326,11 +318,10 @@ def imports( "azure.core.exceptions", "ResourceExistsError", ImportType.AZURECORE ) - kwargs_to_pop = self.parameters.kwargs_to_pop(is_python3_file) if self.has_kwargs_to_pop_with_default( - kwargs_to_pop, ParameterLocation.HEADER + self.parameters.kwargs_to_pop, ParameterLocation.HEADER ) or self.has_kwargs_to_pop_with_default( - kwargs_to_pop, ParameterLocation.QUERY + self.parameters.kwargs_to_pop, ParameterLocation.QUERY ): file_import.add_submodule_import( "azure.core.utils", "case_insensitive_dict", ImportType.AZURECORE @@ -468,10 +459,8 @@ def from_yaml(cls, yaml_data: Dict[str, Any], code_model: "CodeModel"): class Operation(OperationBase[Response]): - def imports( - self, async_mode: bool, is_python3_file: bool, **kwargs: Any - ) -> FileImport: - file_import = super().imports(async_mode, is_python3_file, **kwargs) + def imports(self, async_mode: bool, **kwargs: Any) -> FileImport: + file_import = super().imports(async_mode, **kwargs) if self.abstract: return file_import if async_mode: diff --git a/autorest/codegen/models/operation_group.py b/autorest/codegen/models/operation_group.py index 18e238b810f..23ea74d4736 100644 --- a/autorest/codegen/models/operation_group.py +++ b/autorest/codegen/models/operation_group.py @@ -36,12 +36,11 @@ def __init__( def has_abstract_operations(self) -> bool: return any(o for o in self.operations if o.abstract) - def base_class(self, async_mode: bool) -> str: + @property + def base_class(self) -> str: base_classes: List[str] = [] if self.is_mixin and self.code_model.need_mixin_abc: base_classes.append("MixinABC") - if not (async_mode or self.code_model.options["python3_only"]): - base_classes.append("object") return ", ".join(base_classes) def imports_for_multiapi(self, async_mode: bool) -> FileImport: @@ -67,15 +66,13 @@ def mypy_ignore(self) -> str: return " # type: ignore" return "" - def imports(self, async_mode: bool, is_python3_file: bool) -> FileImport: + def imports(self, async_mode: bool) -> FileImport: file_import = FileImport() relative_path = "..." if async_mode else ".." for operation in self.operations: file_import.merge( - operation.imports( - async_mode, is_python3_file, relative_path=relative_path - ) + operation.imports(async_mode, relative_path=relative_path) ) # for multiapi if not self.code_model.options["version_tolerant"]: diff --git a/autorest/codegen/models/paging_operation.py b/autorest/codegen/models/paging_operation.py index ffe3787119c..7836a0250ef 100644 --- a/autorest/codegen/models/paging_operation.py +++ b/autorest/codegen/models/paging_operation.py @@ -127,13 +127,11 @@ def _imports_shared(self, async_mode: bool, **kwargs: Any) -> FileImport: def has_optional_return_type(self) -> bool: return False - def imports( - self, async_mode: bool, is_python3_file: bool, **kwargs: Any - ) -> FileImport: + def imports(self, async_mode: bool, **kwargs: Any) -> FileImport: if self.abstract: return FileImport() file_import = self._imports_shared(async_mode, **kwargs) - file_import.merge(super().imports(async_mode, is_python3_file, **kwargs)) + file_import.merge(super().imports(async_mode, **kwargs)) if self.code_model.options["tracing"] and self.want_tracing: file_import.add_submodule_import( "azure.core.tracing.decorator", diff --git a/autorest/codegen/models/parameter.py b/autorest/codegen/models/parameter.py index fecac063cbb..686b8760b1d 100644 --- a/autorest/codegen/models/parameter.py +++ b/autorest/codegen/models/parameter.py @@ -179,15 +179,11 @@ def docstring_type_keyword(self) -> str: def in_method_signature(self) -> bool: ... - def method_signature(self, is_python3_file: bool, async_mode: bool) -> str: + def method_signature(self, async_mode: bool) -> str: type_annot = self.type_annotation(async_mode=async_mode) - if is_python3_file: - if self.client_default_value is not None or self.optional: - return f"{self.client_name}: {type_annot} = {self.client_default_value_declaration}," - return f"{self.client_name}: {type_annot}," if self.client_default_value is not None or self.optional: - return f"{self.client_name}={self.client_default_value_declaration}, # type: {type_annot}" - return f"{self.client_name}, # type: {type_annot}" + return f"{self.client_name}: {type_annot} = {self.client_default_value_declaration}," + return f"{self.client_name}: {type_annot}," class _BodyParameterBase(_ParameterBase): diff --git a/autorest/codegen/models/parameter_list.py b/autorest/codegen/models/parameter_list.py index 1a869b781b1..b4262f30d92 100644 --- a/autorest/codegen/models/parameter_list.py +++ b/autorest/codegen/models/parameter_list.py @@ -235,49 +235,36 @@ def method(self) -> List[Union[ParameterType, BodyParameterType]]: """Sorted method params. First positional, then keyword only, then kwarg""" return self.positional + self.keyword_only + self.kwarg - def method_signature(self, is_python3_file: bool, async_mode: bool) -> List[str]: + def method_signature(self, async_mode: bool) -> List[str]: """Method signature for this parameter list.""" return method_signature_helper( - positional=self.method_signature_positional(is_python3_file, async_mode), - keyword_only=self.method_signature_keyword_only( - is_python3_file, async_mode - ), - kwarg_params=self.method_signature_kwargs(is_python3_file), + positional=self.method_signature_positional(async_mode), + keyword_only=self.method_signature_keyword_only(async_mode), + kwarg_params=self.method_signature_kwargs, ) - def method_signature_positional( - self, is_python3_file: bool, async_mode: bool - ) -> List[str]: + def method_signature_positional(self, async_mode: bool) -> List[str]: """Signature for positional parameters""" - return [ - parameter.method_signature(is_python3_file, async_mode) - for parameter in self.positional - ] + return [parameter.method_signature(async_mode) for parameter in self.positional] - def method_signature_keyword_only( - self, is_python3_file: bool, async_mode: bool - ) -> List[str]: + def method_signature_keyword_only(self, async_mode: bool) -> List[str]: """Signature for keyword only parameters""" - if not (self.keyword_only and is_python3_file): + if not self.keyword_only: return [] return ["*,"] + [ - parameter.method_signature(is_python3_file, async_mode) - for parameter in self.keyword_only + parameter.method_signature(async_mode) for parameter in self.keyword_only ] - @staticmethod - def method_signature_kwargs(is_python3_file: bool) -> List[str]: + @property + def method_signature_kwargs(self) -> List[str]: """Signature for kwargs""" - return ["**kwargs: Any"] if is_python3_file else ["**kwargs # type: Any"] + return ["**kwargs: Any"] - def kwargs_to_pop( - self, is_python3_file: bool - ) -> List[Union[ParameterType, BodyParameterType]]: + @property + def kwargs_to_pop(self) -> List[Union[ParameterType, BodyParameterType]]: """Method kwargs we want to pop""" # don't want to pop bodies unless it's a constant kwargs_to_pop = self.kwarg - if not is_python3_file: - kwargs_to_pop += self.keyword_only return [ k for k in kwargs_to_pop @@ -416,14 +403,12 @@ class RequestBuilderParameterList(_RequestBuilderParameterList): class OverloadedRequestBuilderParameterList(_RequestBuilderParameterList): """Parameter list for OverloadedRequestBuilder""" - def method_signature_keyword_only( - self, is_python3_file: bool, async_mode: bool - ) -> List[str]: + def method_signature_keyword_only(self, async_mode: bool) -> List[str]: """Signature for keyword only parameters""" - if not (self.keyword_only and is_python3_file): + if not self.keyword_only: return [] return ["*,"] + [ - parameter.method_signature(is_python3_file, async_mode) + parameter.method_signature(async_mode) for parameter in self.keyword_only if parameter.location != ParameterLocation.BODY ] @@ -478,13 +463,12 @@ def host(self) -> Optional[ClientParameter]: except StopIteration: return None - def kwargs_to_pop( - self, is_python3_file: bool - ) -> List[Union[ClientParameter, BodyParameter]]: + @property + def kwargs_to_pop(self) -> List[Union[ClientParameter, BodyParameter]]: """We only want to pass base url path parameters in the client""" return [ k - for k in super().kwargs_to_pop(is_python3_file=is_python3_file) + for k in super().kwargs_to_pop if k.location == ParameterLocation.ENDPOINT_PATH ] diff --git a/autorest/codegen/serializers/__init__.py b/autorest/codegen/serializers/__init__.py index c1c90b5a00e..7ade204a012 100644 --- a/autorest/codegen/serializers/__init__.py +++ b/autorest/codegen/serializers/__init__.py @@ -14,9 +14,8 @@ from ..models import TokenCredentialType from .enum_serializer import EnumSerializer from .general_serializer import GeneralSerializer -from .model_generic_serializer import ModelGenericSerializer from .model_init_serializer import ModelInitSerializer -from .model_python3_serializer import ModelPython3Serializer +from .model_serializer import ModelSerializer from .operations_init_serializer import OperationsInitSerializer from .operation_groups_serializer import OperationGroupsSerializer from .metadata_serializer import MetadataSerializer @@ -224,22 +223,9 @@ def _serialize_and_write_models_folder( # Write the models folder models_path = namespace_path / Path("models") if self.code_model.model_types: - if not self.code_model.options["python3_only"]: - self._autorestapi.write_file( - models_path - / Path( - f"{self.code_model.get_models_filename(is_python3_file=False)}.py" - ), - ModelGenericSerializer( - code_model=self.code_model, env=env - ).serialize(), - ) self._autorestapi.write_file( - models_path - / Path( - f"{self.code_model.get_models_filename(is_python3_file=True)}.py" - ), - ModelPython3Serializer(code_model=self.code_model, env=env).serialize(), + models_path / Path(f"{self.code_model.models_filename}.py"), + ModelSerializer(code_model=self.code_model, env=env).serialize(), ) if self.code_model.enums: self._autorestapi.write_file( @@ -287,18 +273,6 @@ def _serialize_and_write_single_rest_layer( code_model=self.code_model, env=env, request_builders=request_builders, - is_python3_file=False, - ).serialize_request_builders(), - ) - - # write python3 request builders file - self._autorestapi.write_file( - output_path / Path("_request_builders_py3.py"), - RequestBuildersSerializer( - code_model=self.code_model, - env=env, - request_builders=request_builders, - is_python3_file=True, ).serialize_request_builders(), ) @@ -309,7 +283,6 @@ def _serialize_and_write_single_rest_layer( code_model=self.code_model, env=env, request_builders=request_builders, - is_python3_file=True, ).serialize_init(), ) @@ -325,7 +298,6 @@ def _serialize_and_write_operations_file( code_model=self.code_model, env=env, async_mode=False, - is_python3_file=self.code_model.options["python3_only"], operation_group=operation_group, ) self._autorestapi.write_file( @@ -335,31 +307,12 @@ def _serialize_and_write_operations_file( operation_group_serializer.serialize(), ) - if ( - not self.code_model.options["python3_only"] - and self.code_model.options["add_python3_operation_files"] - ): - # write typed second file if not python 3 only - operation_group_serializer = OperationGroupsSerializer( - code_model=self.code_model, - env=env, - async_mode=False, - is_python3_file=True, - ) - self._autorestapi.write_file( - namespace_path - / Path(self.code_model.operations_folder_name) - / Path(f"{filename}_py3.py"), - operation_group_serializer.serialize(), - ) - if self.has_aio_folder: # write async operation group and operation files operation_group_async_serializer = OperationGroupsSerializer( code_model=self.code_model, env=env, async_mode=True, - is_python3_file=True, operation_group=operation_group, ) self._autorestapi.write_file( diff --git a/autorest/codegen/serializers/builder_serializer.py b/autorest/codegen/serializers/builder_serializer.py index 178edec372a..50783c3bdd7 100644 --- a/autorest/codegen/serializers/builder_serializer.py +++ b/autorest/codegen/serializers/builder_serializer.py @@ -176,12 +176,9 @@ def _get_json_response_template_to_status_codes( class _BuilderBaseSerializer(Generic[BuilderType]): # pylint: disable=abstract-method - def __init__( - self, code_model: CodeModel, async_mode: bool, is_python3_file: bool - ) -> None: + def __init__(self, code_model: CodeModel, async_mode: bool) -> None: self.code_model = code_model self.async_mode = async_mode - self.is_python3_file = is_python3_file self.parameter_serializer = ParameterSerializer() @property @@ -225,9 +222,7 @@ def _method_signature(self, builder: BuilderType) -> str: function_def=self._function_def, method_name=builder.name, need_self_param=self._need_self_param, - method_param_signatures=builder.method_signature( - self.async_mode or self.is_python3_file, self.async_mode - ), + method_param_signatures=builder.method_signature(self.async_mode), pylint_disable=builder.pylint_disable, ) @@ -245,7 +240,6 @@ def method_signature_and_response_type_annotation( return ( decorators_str + utils.method_signature_and_response_type_annotation_template( - is_python3_file=self.is_python3_file, method_signature=method_signature, response_type_annotation=response_type_annotation, ) @@ -442,7 +436,7 @@ def response_docstring(self, builder: RequestBuilderType) -> List[str]: def pop_kwargs_from_signature(self, builder: RequestBuilderType) -> List[str]: return self.parameter_serializer.pop_kwargs_from_signature( - builder.parameters.kwargs_to_pop(is_python3_file=self.is_python3_file), + builder.parameters.kwargs_to_pop, check_kwarg_dict=True, pop_headers_kwarg=PopKwargType.CASE_INSENSITIVE if bool(builder.parameters.headers) @@ -452,7 +446,8 @@ def pop_kwargs_from_signature(self, builder: RequestBuilderType) -> List[str]: else PopKwargType.NO, ) - def create_http_request(self, builder: RequestBuilderType) -> List[str]: + @staticmethod + def create_http_request(builder: RequestBuilderType) -> List[str]: retval = ["return HttpRequest("] retval.append(f' method="{builder.method}",') retval.append(" url=_url,") @@ -465,9 +460,9 @@ def create_http_request(self, builder: RequestBuilderType) -> List[str]: and builder.parameters.body_parameter.in_method_signature ): body_param = builder.parameters.body_parameter - if body_param.constant or ( - self.is_python3_file - and body_param.method_location != ParameterMethodLocation.KWARG + if ( + body_param.constant + or body_param.method_location != ParameterMethodLocation.KWARG ): # we only need to pass it through if it's not a kwarg or it's a popped kwarg retval.append( @@ -611,9 +606,7 @@ def param_description( return description_list def pop_kwargs_from_signature(self, builder: OperationType) -> List[str]: - kwargs_to_pop = builder.parameters.kwargs_to_pop( - is_python3_file=self.is_python3_file - ) + kwargs_to_pop = builder.parameters.kwargs_to_pop kwargs = self.parameter_serializer.pop_kwargs_from_signature( kwargs_to_pop, check_kwarg_dict=True, @@ -1103,15 +1096,12 @@ class OperationSerializer(_OperationSerializer[Operation]): class _PagingOperationSerializer( _OperationSerializer[PagingOperationType] ): # pylint: disable=abstract-method - def __init__( - self, code_model: CodeModel, async_mode: bool, is_python3_file: bool - ) -> None: + def __init__(self, code_model: CodeModel, async_mode: bool) -> None: # for pylint reasons need to redefine init # probably because inheritance is going too deep - super().__init__(code_model, async_mode, is_python3_file) + super().__init__(code_model, async_mode) self.code_model = code_model self.async_mode = async_mode - self.is_python3_file = is_python3_file self.parameter_serializer = ParameterSerializer() def serialize_path(self, builder: PagingOperationType) -> List[str]: @@ -1235,15 +1225,12 @@ class PagingOperationSerializer(_PagingOperationSerializer[PagingOperation]): class _LROOperationSerializer(_OperationSerializer[LROOperationType]): - def __init__( - self, code_model: CodeModel, async_mode: bool, is_python3_file: bool - ) -> None: + def __init__(self, code_model: CodeModel, async_mode: bool) -> None: # for pylint reasons need to redefine init # probably because inheritance is going too deep - super().__init__(code_model, async_mode, is_python3_file) + super().__init__(code_model, async_mode) self.code_model = code_model self.async_mode = async_mode - self.is_python3_file = is_python3_file self.parameter_serializer = ParameterSerializer() def param_description(self, builder: LROOperationType) -> List[str]: @@ -1423,7 +1410,6 @@ def get_operation_serializer( builder: Operation, code_model, async_mode: bool, - is_python3_file: bool, ) -> Union[ OperationSerializer, PagingOperationSerializer, @@ -1442,4 +1428,4 @@ def get_operation_serializer( retcls = LROOperationSerializer elif builder.operation_type == "paging": retcls = PagingOperationSerializer - return retcls(code_model, async_mode, is_python3_file) + return retcls(code_model, async_mode) diff --git a/autorest/codegen/serializers/client_serializer.py b/autorest/codegen/serializers/client_serializer.py index 1b2c9df5e80..44365781c14 100644 --- a/autorest/codegen/serializers/client_serializer.py +++ b/autorest/codegen/serializers/client_serializer.py @@ -11,9 +11,8 @@ class ClientSerializer: - def __init__(self, code_model: CodeModel, is_python3_file: bool) -> None: + def __init__(self, code_model: CodeModel) -> None: self.code_model = code_model - self.is_python3_file = is_python3_file self.parameter_serializer = ParameterSerializer() def _init_signature(self, async_mode: bool) -> str: @@ -22,23 +21,20 @@ def _init_signature(self, async_mode: bool) -> str: method_name="__init__", need_self_param=True, method_param_signatures=self.code_model.client.parameters.method_signature( - async_mode or self.is_python3_file, async_mode + async_mode ), ) def init_signature_and_response_type_annotation(self, async_mode: bool) -> str: init_signature = self._init_signature(async_mode) return utils.method_signature_and_response_type_annotation_template( - is_python3_file=async_mode or self.is_python3_file, method_signature=init_signature, response_type_annotation="None", ) def pop_kwargs_from_signature(self, async_mode: bool) -> List[str]: return self.parameter_serializer.pop_kwargs_from_signature( - self.code_model.client.parameters.kwargs_to_pop( - async_mode or self.is_python3_file, - ), + self.code_model.client.parameters.kwargs_to_pop, check_kwarg_dict=False, pop_headers_kwarg=PopKwargType.NO, pop_params_kwarg=PopKwargType.NO, @@ -50,8 +46,6 @@ def class_definition(self, async_mode) -> str: base_class = "" if has_mixin_og: base_class = f"{class_name}OperationsMixin" - elif not (async_mode or self.is_python3_file): - base_class = "object" pylint_disable = self.code_model.client.pylint_disable if base_class: return f"class {class_name}({base_class}):{pylint_disable}" @@ -147,16 +141,9 @@ def serializers_and_operation_groups_properties(self) -> List[str]: return retval def _send_request_signature(self, async_mode: bool) -> str: - is_python3_file = async_mode or self.code_model.options["python3_only"] - request_signature = [ + send_request_signature = [ "request: HttpRequest," - if is_python3_file - else "request, # type: HttpRequest" - ] - send_request_signature = ( - request_signature - + self.code_model.client.parameters.method_signature_kwargs(is_python3_file) - ) + ] + self.code_model.client.parameters.method_signature_kwargs return self.parameter_serializer.serialize_method( function_def="def", method_name=self.code_model.client.send_request_name, @@ -169,7 +156,6 @@ def send_request_signature_and_response_type_annotation( ) -> str: send_request_signature = self._send_request_signature(async_mode) return utils.method_signature_and_response_type_annotation_template( - is_python3_file=async_mode or self.is_python3_file, method_signature=send_request_signature, response_type_annotation="Awaitable[AsyncHttpResponse]" if async_mode @@ -255,10 +241,9 @@ def serialize_path(self) -> List[str]: class ConfigSerializer: - def __init__(self, code_model: CodeModel, is_python3_file: bool) -> None: + def __init__(self, code_model: CodeModel) -> None: self.code_model = code_model self.parameter_serializer = ParameterSerializer() - self.is_python3_file = is_python3_file def _init_signature(self, async_mode: bool) -> str: return self.parameter_serializer.serialize_method( @@ -266,23 +251,20 @@ def _init_signature(self, async_mode: bool) -> str: method_name="__init__", need_self_param=True, method_param_signatures=self.code_model.config.parameters.method_signature( - async_mode or self.is_python3_file, async_mode + async_mode ), ) def init_signature_and_response_type_annotation(self, async_mode: bool) -> str: init_signature = self._init_signature(async_mode) return utils.method_signature_and_response_type_annotation_template( - is_python3_file=async_mode or self.is_python3_file, method_signature=init_signature, response_type_annotation="None", ) def pop_kwargs_from_signature(self, async_mode: bool) -> List[str]: return self.parameter_serializer.pop_kwargs_from_signature( - self.code_model.config.parameters.kwargs_to_pop( - async_mode or self.is_python3_file - ), + self.code_model.config.parameters.kwargs_to_pop, check_kwarg_dict=False, pop_headers_kwarg=PopKwargType.NO, pop_params_kwarg=PopKwargType.NO, diff --git a/autorest/codegen/serializers/general_serializer.py b/autorest/codegen/serializers/general_serializer.py index ab491e2a322..b8adf4feacd 100644 --- a/autorest/codegen/serializers/general_serializer.py +++ b/autorest/codegen/serializers/general_serializer.py @@ -34,14 +34,12 @@ def serialize_service_client_file(self) -> str: template = self.env.get_template("client.py.jinja2") - python3_only = self.code_model.options["python3_only"] return template.render( code_model=self.code_model, async_mode=self.async_mode, - serializer=ClientSerializer(self.code_model, is_python3_file=python3_only), + serializer=ClientSerializer(self.code_model), imports=FileImportSerializer( self.code_model.client.imports(self.async_mode), - is_python3_file=self.async_mode or python3_only, ), ) @@ -85,7 +83,6 @@ def serialize_vendor_file(self) -> str: code_model=self.code_model, imports=FileImportSerializer( file_import, - is_python3_file=self.async_mode, ), async_mode=self.async_mode, ) @@ -99,15 +96,13 @@ def serialize_config_file(self) -> str: package_name if package_name else self.code_model.client.name.lower() ) template = self.env.get_template("config.py.jinja2") - python3_only = self.code_model.options["python3_only"] return template.render( code_model=self.code_model, async_mode=self.async_mode, imports=FileImportSerializer( self.code_model.config.imports(self.async_mode), - is_python3_file=self.async_mode or python3_only, ), - serializer=ConfigSerializer(self.code_model, is_python3_file=python3_only), + serializer=ConfigSerializer(self.code_model), sdk_moniker=sdk_moniker, ) diff --git a/autorest/codegen/serializers/import_serializer.py b/autorest/codegen/serializers/import_serializer.py index f925246578c..c22de804bff 100644 --- a/autorest/codegen/serializers/import_serializer.py +++ b/autorest/codegen/serializers/import_serializer.py @@ -58,11 +58,8 @@ def _get_import_clauses(imports: List[ImportModel], delimiter: str) -> List[str] class FileImportSerializer: - def __init__( - self, file_import: FileImport, is_python3_file: bool, async_mode: bool = False - ) -> None: + def __init__(self, file_import: FileImport, async_mode: bool = False) -> None: self.file_import = file_import - self.is_python3_file = is_python3_file self.async_mode = async_mode def _get_imports_list( @@ -82,20 +79,14 @@ def _get_imports_list( return file_import_copy.get_imports_from_section(baseline_typing_section) def _add_type_checking_import(self): - any_typing = any( - self.file_import.get_imports_from_section(TypingSection.TYPING) - ) - conditional_and_not_py3 = not self.is_python3_file and any( - self.file_import.get_imports_from_section(TypingSection.CONDITIONAL) - ) - if any_typing or conditional_and_not_py3: + if any(self.file_import.get_imports_from_section(TypingSection.TYPING)): self.file_import.add_submodule_import( "typing", "TYPE_CHECKING", ImportType.STDLIB ) def _get_typing_definitions(self) -> str: def declare_defintion( - spacing: str, type_name: str, type_definition: TypeDefinition + type_name: str, type_definition: TypeDefinition ) -> List[str]: ret: List[str] = [] definition_value = ( @@ -112,21 +103,20 @@ def declare_defintion( ): if version is not None: ret.append( - "{}{} sys.version_info >= {}:".format( - spacing, "if" if i == 0 else "elif", version + "{} sys.version_info >= {}:".format( + "if" if i == 0 else "elif", version ) ) elif i > 0: - ret.append("{}else:".format(spacing)) + ret.append("else:") for import_clause in _get_import_clauses( [type_definition.version_imports[version]], "\n" ): ret.append( - "{}{}{}".format( + "{}{}".format( " " if len(versions) > 1 or version is not None else "", - spacing, import_clause, ) ) @@ -134,15 +124,14 @@ def declare_defintion( ret[ -1 ] += " # type: ignore # pylint: disable=ungrouped-imports" - ret.append("{}{} = {}".format(spacing, type_name, definition_value)) + ret.append("{} = {}".format(type_name, definition_value)) return ret if not self.file_import.type_definitions: return "" - spacing = "" if self.is_python3_file else " " declarations: List[str] = [""] for type_name, value in self.file_import.type_definitions.items(): - declarations.extend(declare_defintion(spacing, type_name, value)) + declarations.extend(declare_defintion(type_name, value)) return "\n".join(declarations) def __str__(self) -> str: @@ -150,7 +139,7 @@ def __str__(self) -> str: regular_imports = "" regular_imports_list = self._get_imports_list( baseline_typing_section=TypingSection.REGULAR, - add_conditional_typing=self.is_python3_file, + add_conditional_typing=True, ) if regular_imports_list: @@ -161,7 +150,7 @@ def __str__(self) -> str: typing_imports = "" typing_imports_list = self._get_imports_list( baseline_typing_section=TypingSection.TYPING, - add_conditional_typing=not self.is_python3_file, + add_conditional_typing=False, ) if typing_imports_list: typing_imports += "\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n " diff --git a/autorest/codegen/serializers/metadata_serializer.py b/autorest/codegen/serializers/metadata_serializer.py index 345b46969af..4d30cedf324 100644 --- a/autorest/codegen/serializers/metadata_serializer.py +++ b/autorest/codegen/serializers/metadata_serializer.py @@ -143,13 +143,11 @@ def _is_paging(operation): get_operation_serializer, code_model=self.code_model, async_mode=True, - is_python3_file=True, ), get_sync_operation_serializer=functools.partial( get_operation_serializer, code_model=self.code_model, async_mode=False, - is_python3_file=False, ), has_credential=bool(self.code_model.credential), ) diff --git a/autorest/codegen/serializers/model_generic_serializer.py b/autorest/codegen/serializers/model_generic_serializer.py deleted file mode 100644 index 07da9d3f05b..00000000000 --- a/autorest/codegen/serializers/model_generic_serializer.py +++ /dev/null @@ -1,32 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import List -from jinja2 import Environment -from .model_base_serializer import ModelBaseSerializer -from ..models import ModelType, CodeModel, Property - - -class ModelGenericSerializer(ModelBaseSerializer): - def __init__(self, code_model: CodeModel, env: Environment) -> None: - super().__init__(code_model=code_model, env=env, is_python3_file=False) - - def init_line(self, model: ModelType) -> List[str]: - return [] - - def properties_to_pass_to_super(self, model: ModelType) -> str: - return "**kwargs" - - def required_property_no_default_init(self, prop: Property) -> str: - return f"self.{prop.client_name} = kwargs['{prop.client_name}']" - - def optional_property_init(self, prop: Property) -> str: - return f"self.{prop.client_name} = kwargs.get('{prop.client_name}', {prop.client_default_value_declaration})" - - def initialize_standard_arg(self, prop: Property) -> str: - return self.initialize_standard_property(prop) - - def super_call_template(self, model: ModelType) -> str: - return "super(" + model.name + ", self).__init__({})" diff --git a/autorest/codegen/serializers/model_python3_serializer.py b/autorest/codegen/serializers/model_python3_serializer.py deleted file mode 100644 index 297c54dc4a4..00000000000 --- a/autorest/codegen/serializers/model_python3_serializer.py +++ /dev/null @@ -1,72 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from typing import List -from jinja2 import Environment -from .model_base_serializer import ModelBaseSerializer -from ..models import ModelType, CodeModel, Property -from ..models.imports import FileImport - - -class ModelPython3Serializer(ModelBaseSerializer): - def __init__(self, code_model: CodeModel, env: Environment) -> None: - super().__init__(code_model=code_model, env=env, is_python3_file=True) - - def init_line(self, model: ModelType) -> List[str]: - init_properties_declaration = [] - init_line_parameters = [ - p - for p in model.properties - if not p.readonly and not p.is_discriminator and not p.constant - ] - init_line_parameters.sort(key=lambda x: x.optional) - if init_line_parameters: - init_properties_declaration.append("*,") - for param in init_line_parameters: - init_properties_declaration.append(self.initialize_standard_property(param)) - - return init_properties_declaration - - def properties_to_pass_to_super(self, model: ModelType) -> str: - properties_to_pass_to_super = [] - for parent in model.parents: - for prop in model.properties: - if ( - prop in parent.properties - and not prop.is_discriminator - and not prop.constant - and not prop.readonly - ): - properties_to_pass_to_super.append( - f"{prop.client_name}={prop.client_name}" - ) - properties_to_pass_to_super.append("**kwargs") - return ", ".join(properties_to_pass_to_super) - - def required_property_no_default_init(self, prop: Property) -> str: - return f"{prop.client_name}: {prop.type_annotation()},{prop.pylint_disable}" - - def optional_property_init(self, prop: Property) -> str: - return ( - f"{prop.client_name}: {prop.type_annotation()} = " - f"{prop.client_default_value_declaration},{prop.pylint_disable}" - ) - - def initialize_standard_arg(self, prop: Property) -> str: - return f"self.{prop.client_name} = {prop.client_name}" - - def super_call_template(self, model: ModelType) -> str: - return "super().__init__({})" - - def imports(self) -> FileImport: - file_import = super(ModelPython3Serializer, self).imports() - for model in self.code_model.model_types: - init_line_parameters = [ - p for p in model.properties if not p.readonly and not p.is_discriminator - ] - for param in init_line_parameters: - file_import.merge(param.imports()) - - return file_import diff --git a/autorest/codegen/serializers/model_base_serializer.py b/autorest/codegen/serializers/model_serializer.py similarity index 69% rename from autorest/codegen/serializers/model_base_serializer.py rename to autorest/codegen/serializers/model_serializer.py index 7f75abe0aea..ff15a830477 100644 --- a/autorest/codegen/serializers/model_base_serializer.py +++ b/autorest/codegen/serializers/model_serializer.py @@ -3,7 +3,6 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from abc import abstractmethod from typing import cast, List from jinja2 import Environment from ..models import ModelType, CodeModel, Property @@ -27,22 +26,17 @@ def _documentation_string( return retval -class ModelBaseSerializer: - def __init__( - self, code_model: CodeModel, env: Environment, is_python3_file: bool - ) -> None: +class ModelSerializer: + def __init__(self, code_model: CodeModel, env: Environment) -> None: self.code_model = code_model self.env = env - self.is_python3_file = is_python3_file def serialize(self) -> str: # Generate the models template = self.env.get_template("model_container.py.jinja2") return template.render( code_model=self.code_model, - imports=FileImportSerializer( - self.imports(), is_python3_file=self.is_python3_file - ), + imports=FileImportSerializer(self.imports()), str=str, serializer=self, ) @@ -54,6 +48,11 @@ def imports(self) -> FileImport: ) for model in self.code_model.model_types: file_import.merge(model.imports(is_operation_file=False)) + init_line_parameters = [ + p for p in model.properties if not p.readonly and not p.is_discriminator + ] + for param in init_line_parameters: + file_import.merge(param.imports()) return file_import @staticmethod @@ -92,18 +91,12 @@ def input_documentation_string(prop: Property) -> List[str]: def variable_documentation_string(prop: Property) -> List[str]: return _documentation_string(prop, "ivar", "vartype") - @abstractmethod - def super_call_template(self, model: ModelType) -> str: - ... - def super_call(self, model: ModelType): - return self.super_call_template(model).format( - self.properties_to_pass_to_super(model) - ) + return f"super().__init__({self.properties_to_pass_to_super(model)})" def initialize_properties(self, model: ModelType) -> List[str]: init_args = [] - for prop in ModelBaseSerializer.get_properties_to_initialize(model): + for prop in self.get_properties_to_initialize(model): if prop.is_discriminator: discriminator_value = ( f"'{model.discriminator_value}'" @@ -120,13 +113,16 @@ def initialize_properties(self, model: ModelType) -> List[str]: elif prop.readonly: init_args.append(f"self.{prop.client_name} = None") elif not prop.constant: - init_args.append(self.initialize_standard_arg(prop)) + init_args.append(f"self.{prop.client_name} = {prop.client_name}") return init_args def initialize_standard_property(self, prop: Property): if not (prop.optional or prop.client_default_value is not None): - return self.required_property_no_default_init(prop) - return self.optional_property_init(prop) + return f"{prop.client_name}: {prop.type_annotation()},{prop.pylint_disable}" + return ( + f"{prop.client_name}: {prop.type_annotation()} = " + f"{prop.client_default_value_declaration},{prop.pylint_disable}" + ) @staticmethod def discriminator_docstring(model: ModelType) -> str: @@ -135,22 +131,33 @@ def discriminator_docstring(model: ModelType) -> str: f"Known sub-classes are: {', '.join(v.name for v in model.discriminated_subtypes.values())}" ) - @abstractmethod def init_line(self, model: ModelType) -> List[str]: - ... + init_properties_declaration = [] + init_line_parameters = [ + p + for p in model.properties + if not p.readonly and not p.is_discriminator and not p.constant + ] + init_line_parameters.sort(key=lambda x: x.optional) + if init_line_parameters: + init_properties_declaration.append("*,") + for param in init_line_parameters: + init_properties_declaration.append(self.initialize_standard_property(param)) + + return init_properties_declaration - @abstractmethod def properties_to_pass_to_super(self, model: ModelType) -> str: - ... - - @abstractmethod - def required_property_no_default_init(self, prop: Property) -> str: - ... - - @abstractmethod - def optional_property_init(self, prop: Property) -> str: - ... - - @abstractmethod - def initialize_standard_arg(self, prop: Property) -> str: - ... + properties_to_pass_to_super = [] + for parent in model.parents: + for prop in model.properties: + if ( + prop in parent.properties + and not prop.is_discriminator + and not prop.constant + and not prop.readonly + ): + properties_to_pass_to_super.append( + f"{prop.client_name}={prop.client_name}" + ) + properties_to_pass_to_super.append("**kwargs") + return ", ".join(properties_to_pass_to_super) diff --git a/autorest/codegen/serializers/operation_groups_serializer.py b/autorest/codegen/serializers/operation_groups_serializer.py index 8779d45b976..0e3bd7e938e 100644 --- a/autorest/codegen/serializers/operation_groups_serializer.py +++ b/autorest/codegen/serializers/operation_groups_serializer.py @@ -22,13 +22,11 @@ def __init__( code_model: CodeModel, env: Environment, async_mode: bool, - is_python3_file: bool, operation_group: Optional[OperationGroup] = None, ) -> None: self.code_model = code_model self.env = env self.async_mode = async_mode - self.is_python3_file = is_python3_file self.operation_group = operation_group def serialize(self) -> str: @@ -42,7 +40,6 @@ def serialize(self) -> str: imports.merge( operation_group.imports( async_mode=self.async_mode, - is_python3_file=self.is_python3_file, ) ) @@ -54,21 +51,17 @@ def serialize(self) -> str: operation_groups=operation_groups, imports=FileImportSerializer( imports, - is_python3_file=self.is_python3_file, async_mode=self.async_mode, ), async_mode=self.async_mode, - is_python3_file=self.is_python3_file, get_operation_serializer=functools.partial( get_operation_serializer, code_model=self.code_model, async_mode=self.async_mode, - is_python3_file=self.is_python3_file, ), request_builder_serializer=RequestBuilderSerializer( self.code_model, async_mode=False, - is_python3_file=self.is_python3_file, ), request_builders=[ rb for rb in self.code_model.request_builders if not rb.abstract diff --git a/autorest/codegen/serializers/operations_init_serializer.py b/autorest/codegen/serializers/operations_init_serializer.py index c6460b60423..0ea3cd8ac6e 100644 --- a/autorest/codegen/serializers/operations_init_serializer.py +++ b/autorest/codegen/serializers/operations_init_serializer.py @@ -18,40 +18,19 @@ def __init__( self.env = env self.async_mode = async_mode - def _operation_group_imports_helper(self, filename_suffix: str = "") -> List[str]: + def operation_group_imports(self) -> List[str]: def _get_filename(operation_group: OperationGroup) -> str: - prefix = ( + return ( "_operations" if self.code_model.options["combine_operation_files"] else operation_group.filename ) - return prefix + filename_suffix return [ f"from .{_get_filename(og)} import {og.class_name}" for og in self.code_model.operation_groups ] - def operation_group_imports(self) -> List[str]: - typed_py3_files = self.code_model.options["add_python3_operation_files"] - py3_only = self.code_model.options["python3_only"] - if typed_py3_files and not py3_only and not self.async_mode: - retval: List[str] = ["try:"] - retval.extend( - [ - f" {line}" - for line in self._operation_group_imports_helper( - filename_suffix="_py3" - ) - ] - ) - retval.append("except (SyntaxError, ImportError):") - retval.extend( - [f" {line}" for line in self._operation_group_imports_helper()] - ) - return retval - return self._operation_group_imports_helper() - def serialize(self) -> str: operation_group_init_template = self.env.get_template( "operations_folder_init.py.jinja2" diff --git a/autorest/codegen/serializers/patch_serializer.py b/autorest/codegen/serializers/patch_serializer.py index 999a0ab7bc4..ac4ecc44a42 100644 --- a/autorest/codegen/serializers/patch_serializer.py +++ b/autorest/codegen/serializers/patch_serializer.py @@ -19,9 +19,7 @@ def serialize(self) -> str: imports.add_submodule_import( "typing", "List", ImportType.STDLIB, TypingSection.CONDITIONAL ) - is_python3_file = self.code_model.options["python3_only"] return template.render( code_model=self.code_model, - imports=FileImportSerializer(imports, is_python3_file=is_python3_file), - is_python3_file=is_python3_file, + imports=FileImportSerializer(imports), ) diff --git a/autorest/codegen/serializers/request_builders_serializer.py b/autorest/codegen/serializers/request_builders_serializer.py index d5b828f7e84..0ed202a721b 100644 --- a/autorest/codegen/serializers/request_builders_serializer.py +++ b/autorest/codegen/serializers/request_builders_serializer.py @@ -18,13 +18,11 @@ def __init__( code_model: CodeModel, env: Environment, request_builders: List[RequestBuilderType], - is_python3_file: bool, ) -> None: self.code_model = code_model self.env = env self.request_builders = request_builders self.group_name = request_builders[0].group_name - self.is_python3_file = is_python3_file @property def imports(self) -> FileImport: @@ -49,9 +47,8 @@ def serialize_request_builders(self) -> str: request_builders=[rb for rb in self.request_builders if not rb.abstract], imports=FileImportSerializer( self.imports, - is_python3_file=True, ), request_builder_serializer=RequestBuilderSerializer( - self.code_model, async_mode=False, is_python3_file=self.is_python3_file + self.code_model, async_mode=False ), ) diff --git a/autorest/codegen/serializers/utils.py b/autorest/codegen/serializers/utils.py index af1325eb2b6..cb86c7f12bf 100644 --- a/autorest/codegen/serializers/utils.py +++ b/autorest/codegen/serializers/utils.py @@ -7,10 +7,7 @@ def method_signature_and_response_type_annotation_template( *, - is_python3_file: bool, method_signature: str, response_type_annotation: str, ) -> str: - if is_python3_file: - return f"{method_signature} -> {response_type_annotation}:" - return f"{method_signature}:\n # type: (...) -> {response_type_annotation}" + return f"{method_signature} -> {response_type_annotation}:" diff --git a/autorest/codegen/templates/client.py.jinja2 b/autorest/codegen/templates/client.py.jinja2 index a639ad9198a..11fc9ed92f8 100644 --- a/autorest/codegen/templates/client.py.jinja2 +++ b/autorest/codegen/templates/client.py.jinja2 @@ -14,7 +14,7 @@ {% if serializer.should_init_super %} super().__init__() {% endif %} - {% if code_model.client.parameters.kwargs_to_pop(async_mode) %} + {% if code_model.client.parameters.kwargs_to_pop %} {{ op_tools.serialize(serializer.pop_kwargs_from_signature(async_mode)) | indent(8) }} {% endif %} {% if code_model.client.has_parameterized_host %} diff --git a/autorest/codegen/templates/config.py.jinja2 b/autorest/codegen/templates/config.py.jinja2 index 0cc4340f182..a36091ca5b2 100644 --- a/autorest/codegen/templates/config.py.jinja2 +++ b/autorest/codegen/templates/config.py.jinja2 @@ -22,7 +22,7 @@ class {{ code_model.client.name }}Configuration(Configuration): # pylint: disab {{ op_tools.serialize_with_wrap(serializer.property_descriptions(async_mode), "\n ") | indent }} {{ serializer.init_signature_and_response_type_annotation(async_mode) | indent }} super({{ code_model.client.name }}Configuration, self).__init__(**kwargs) - {% if code_model.config.parameters.kwargs_to_pop(async_mode) %} + {% if code_model.config.parameters.kwargs_to_pop %} {{ op_tools.serialize(serializer.pop_kwargs_from_signature(async_mode)) | indent(8) }} {% endif %} {% if serializer.check_required_parameters() %} diff --git a/autorest/codegen/templates/metadata.json.jinja2 b/autorest/codegen/templates/metadata.json.jinja2 index 3b6585f211c..c5bcfa0f0d6 100644 --- a/autorest/codegen/templates/metadata.json.jinja2 +++ b/autorest/codegen/templates/metadata.json.jinja2 @@ -20,7 +20,7 @@ "sync": { {% for gp in global_parameters.method | rejectattr("client_name", "equalto", "api_version") | rejectattr("is_host") %} {{ gp.client_name | tojson }}: { - "signature": {{ gp.method_signature(is_python3_file=False, async_mode=False) | tojson }}, + "signature": {{ gp.method_signature(async_mode=False) | tojson }}, "description": {{ gp.description | tojson }}, "docstring_type": {{ gp.docstring_type(async_mode=False) | tojson }}, "required": {{ (not gp.optional) | tojson }} @@ -30,7 +30,7 @@ "async": { {% for gp in global_parameters.method | rejectattr("client_name", "equalto", "api_version") | rejectattr("is_host") %} {{ gp.client_name | tojson }}: { - "signature": {{ (gp.method_signature(is_python3_file=True, async_mode=True)) | tojson }}, + "signature": {{ (gp.method_signature(async_mode=True)) | tojson }}, "description": {{ gp.description | tojson }}, "docstring_type": {{ gp.docstring_type(async_mode=True) | tojson }}, "required": {{ (not gp.optional) | tojson }} @@ -53,7 +53,7 @@ }, {% if not client.has_parameterized_host %} "base_url": { - "signature": {{ client.parameters.host.method_signature(False, async_mode=False) | tojson }}, + "signature": {{ client.parameters.host.method_signature(async_mode=False) | tojson }}, "description": "Service URL", "docstring_type": "str", "required": false @@ -75,7 +75,7 @@ }, {% if not client.has_parameterized_host %} "base_url": { - "signature": {{ client.parameters.host.method_signature(True, async_mode=True) | tojson }}, + "signature": {{ client.parameters.host.method_signature(async_mode=True) | tojson }}, "description": "Service URL", "docstring_type": "str", "required": false diff --git a/autorest/codegen/templates/model_init.py.jinja2 b/autorest/codegen/templates/model_init.py.jinja2 index 26e57603fa9..cef7919a27d 100644 --- a/autorest/codegen/templates/model_init.py.jinja2 +++ b/autorest/codegen/templates/model_init.py.jinja2 @@ -3,21 +3,14 @@ {{ code_model.options['license_header'] }} {% macro iterate_models_py3() %} {% for schema in schemas %} -from .{{ code_model.get_models_filename(is_python3_file=True) }} import {{ schema }} +from .{{ code_model.models_filename }} import {{ schema }} {% endfor %} {% endmacro %} - {% if schemas %} - {% if code_model.options["python3_only"] %} -{{ iterate_models_py3() }} - {% else %} -try: - {{ iterate_models_py3() | indent-}} -except (SyntaxError, ImportError): - {% for schema in schemas %} - from .{{ code_model.get_models_filename(is_python3_file=False) }} import {{ schema }} # type: ignore - {% endfor %} - {% endif %} + + {% for schema in schemas %} +from .{{ code_model.models_filename }} import {{ schema }} + {% endfor %} {% endif %} {% if enums %} diff --git a/autorest/codegen/templates/operation_group.py.jinja2 b/autorest/codegen/templates/operation_group.py.jinja2 index 2cfa0ac41e0..4645c1bb6a1 100644 --- a/autorest/codegen/templates/operation_group.py.jinja2 +++ b/autorest/codegen/templates/operation_group.py.jinja2 @@ -1,5 +1,5 @@ {% set disable = " # pylint: disable=too-many-public-methods" if operation_group.operations | length > 20 else "" %} -{% set base_class = ("(" + operation_group.base_class(async_mode) + ")") if operation_group.base_class(async_mode) else "" %} +{% set base_class = ("(" + operation_group.base_class + ")") if operation_group.base_class else "" %} {% macro check_abstract_methods() %} {% if operation_group.has_abstract_operations %} raise_if_not_implemented(self.__class__, [ diff --git a/autorest/codegen/templates/operation_groups_container.py.jinja2 b/autorest/codegen/templates/operation_groups_container.py.jinja2 index 9a68a189588..cac1fe78aa3 100644 --- a/autorest/codegen/templates/operation_groups_container.py.jinja2 +++ b/autorest/codegen/templates/operation_groups_container.py.jinja2 @@ -8,18 +8,12 @@ {% if code_model.options["builders_visibility"] == "embedded" and not async_mode %} {{ op_tools.declare_serializer(code_model, request_builders) }} -{%- if not is_python3_file %} -# fmt: off -{% endif %} {% for operation_group in operation_groups %} {% for request_builder in request_builders | selectattr("group_name", "equalto", operation_group.property_name) | rejectattr("is_overload") %} {% include "request_builder.py.jinja2" %} {% endfor %} {% endfor %} -{% if not is_python3_file %} -# fmt: on -{% endif %} {% endif %} {% for operation_group in operation_groups %} {% include "operation_group.py.jinja2" %} diff --git a/autorest/codegen/templates/patch.py.jinja2 b/autorest/codegen/templates/patch.py.jinja2 index 2ce349f7b52..6d251b57a7c 100644 --- a/autorest/codegen/templates/patch.py.jinja2 +++ b/autorest/codegen/templates/patch.py.jinja2 @@ -8,8 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python """ {{ imports }} -{% set type_annotation = ": List[str]" %} -__all__{{ type_annotation if is_python3_file else "" }} = []{{ "" if is_python3_file else (" # type" + type_annotation) }} # Add all objects you want publicly available to users at this package level +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): """Do not remove from this file. diff --git a/autorest/codegen/templates/request_builders.py.jinja2 b/autorest/codegen/templates/request_builders.py.jinja2 index 3f7a49e5922..037c7bcc1e8 100644 --- a/autorest/codegen/templates/request_builders.py.jinja2 +++ b/autorest/codegen/templates/request_builders.py.jinja2 @@ -4,9 +4,6 @@ {{ imports }} {{ op_tools.declare_serializer(code_model, request_builders) }} -{% if not is_python3_file %} -# fmt: off -{% endif %} {% for request_builder in request_builders %} {% include "request_builder.py.jinja2" %} diff --git a/autorest/codegen/templates/rest_init.py.jinja2 b/autorest/codegen/templates/rest_init.py.jinja2 index 4ec028d4bbe..9833f3fdc47 100644 --- a/autorest/codegen/templates/rest_init.py.jinja2 +++ b/autorest/codegen/templates/rest_init.py.jinja2 @@ -1,14 +1,9 @@ # coding=utf-8 {{ code_model.options['license_header'] }} -try: - {% for request_builder in request_builders %} - from ._request_builders_py3 import {{ request_builder.name }} - {% endfor %} -except (SyntaxError, ImportError): - {% for request_builder in request_builders %} - from ._request_builders import {{ request_builder.name }} # type: ignore - {% endfor %} +{% for request_builder in request_builders %} +from ._request_builders import {{ request_builder.name }} +{% endfor %} __all__ = [ {% for request_builder in request_builders %} diff --git a/autorest/multiapi/serializers/__init__.py b/autorest/multiapi/serializers/__init__.py index 747b589aeaf..b0c67a9cdd5 100644 --- a/autorest/multiapi/serializers/__init__.py +++ b/autorest/multiapi/serializers/__init__.py @@ -57,18 +57,14 @@ def _render_template(file: str, **kwargs: Any) -> str: ) # serialize service client file - imports = FileImportSerializer( - code_model.client.imports(async_mode), is_python3_file=async_mode - ) + imports = FileImportSerializer(code_model.client.imports(async_mode)) self._autorestapi.write_file( _get_file_path(code_model.client.filename, async_mode), _render_template("client", imports=imports), ) # serialize config file - imports = FileImportSerializer( - code_model.config.imports(async_mode), is_python3_file=async_mode - ) + imports = FileImportSerializer(code_model.config.imports(async_mode)) self._autorestapi.write_file( _get_file_path("_configuration", async_mode), _render_template("config", imports=imports), @@ -77,8 +73,7 @@ def _render_template(file: str, **kwargs: Any) -> str: # serialize mixins if code_model.operation_mixin_group.mixin_operations: imports = FileImportSerializer( - code_model.operation_mixin_group.imports(async_mode), - is_python3_file=async_mode, + code_model.operation_mixin_group.imports(async_mode) ) self._autorestapi.write_file( _get_file_path("_operations_mixin", async_mode), diff --git a/autorest/multiapi/serializers/import_serializer.py b/autorest/multiapi/serializers/import_serializer.py index 2dfc70ac055..1b9f631a74a 100644 --- a/autorest/multiapi/serializers/import_serializer.py +++ b/autorest/multiapi/serializers/import_serializer.py @@ -54,9 +54,8 @@ def _get_import_clauses( class FileImportSerializer: - def __init__(self, file_import: FileImport, is_python3_file: bool) -> None: + def __init__(self, file_import: FileImport) -> None: self._file_import = file_import - self.is_python3_file = is_python3_file def _switch_typing_section_key(self, new_key: TypingSection): switched_dictionary = {} @@ -84,10 +83,7 @@ def _get_imports_dict( return file_import_copy.imports.get(baseline_typing_section, {}) def _add_type_checking_import(self): - if self._file_import.imports.get(TypingSection.TYPING) or ( - not self.is_python3_file - and self._file_import.imports.get(TypingSection.CONDITIONAL) - ): + if self._file_import.imports.get(TypingSection.TYPING): self._file_import.add_submodule_import( "typing", "TYPE_CHECKING", ImportType.STDLIB ) @@ -97,7 +93,7 @@ def __str__(self) -> str: regular_imports = "" regular_imports_dict = self._get_imports_dict( baseline_typing_section=TypingSection.REGULAR, - add_conditional_typing=self.is_python3_file, + add_conditional_typing=True, ) if regular_imports_dict: @@ -108,7 +104,7 @@ def __str__(self) -> str: typing_imports = "" typing_imports_dict = self._get_imports_dict( baseline_typing_section=TypingSection.TYPING, - add_conditional_typing=not self.is_python3_file, + add_conditional_typing=False, ) if typing_imports_dict: typing_imports += "\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n " diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_auto_rest_head_test_service.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_auto_rest_head_test_service.py index 2162c7511da..e196e49d827 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_auto_rest_head_test_service.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_auto_rest_head_test_service.py @@ -7,9 +7,11 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient +from azure.core.credentials import AzureKeyCredential +from azure.core.rest import HttpRequest, HttpResponse from ._configuration import AutoRestHeadTestServiceConfiguration from ._serialization import Deserializer, Serializer @@ -17,12 +19,9 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict + from typing import Dict - from azure.core.credentials import AzureKeyCredential - from azure.core.rest import HttpRequest, HttpResponse - -class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-version-keyword +class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. :ivar http_success: HttpSuccessOperations operations @@ -35,11 +34,10 @@ class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-ver def __init__( self, - credential, # type: AzureKeyCredential - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: AzureKeyCredential, + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -54,10 +52,9 @@ def __init__( def _send_request( self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_configuration.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_configuration.py index d1cae29c5e6..a66c19ef90f 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_configuration.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_configuration.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any from azure.core.configuration import Configuration +from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies from ._version import VERSION -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.credentials import AzureKeyCredential - class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. @@ -32,10 +27,9 @@ class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=to def __init__( self, - credential, # type: AzureKeyCredential - **kwargs # type: Any - ): - # type: (...) -> None + credential: AzureKeyCredential, + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_http_success_operations.py b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_http_success_operations.py index 5532121fc56..79d6b5225ae 100644 --- a/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_http_success_operations.py +++ b/docs/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_http_success_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -16,21 +16,16 @@ from .._serialization import Serializer from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/200") @@ -42,9 +37,8 @@ def build_head200_request( def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/204") @@ -56,9 +50,8 @@ def build_head204_request( def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/404") @@ -68,8 +61,7 @@ def build_head404_request( **kwargs ) -# fmt: on -class HttpSuccessOperations(object): +class HttpSuccessOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -90,9 +82,8 @@ def __init__(self, *args, **kwargs): @distributed_trace def head200( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,9 +131,8 @@ def head200( # pylint: disable=inconsistent-return-statements @distributed_trace def head204( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -190,9 +180,8 @@ def head204( # pylint: disable=inconsistent-return-statements @distributed_trace def head404( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/_auto_rest_head_test_service.py b/docs/samples/specification/basic/generated/azure/basic/sample/_auto_rest_head_test_service.py index 9bd5039813b..fe288e75fde 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/_auto_rest_head_test_service.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/_auto_rest_head_test_service.py @@ -7,9 +7,10 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse from ._configuration import AutoRestHeadTestServiceConfiguration from ._serialization import Deserializer, Serializer @@ -17,11 +18,9 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict + from typing import Dict - from azure.core.rest import HttpRequest, HttpResponse - -class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-version-keyword +class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. :ivar http_success: HttpSuccessOperations operations @@ -32,10 +31,9 @@ class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-ver def __init__( self, - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestHeadTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -50,10 +48,9 @@ def __init__( def _send_request( self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/_configuration.py b/docs/samples/specification/basic/generated/azure/basic/sample/_configuration.py index 177e17de72f..a505171628a 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/_configuration.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/_configuration.py @@ -6,17 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any from azure.core.configuration import Configuration from azure.core.pipeline import policies from ._version import VERSION -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AutoRestHeadTestService. @@ -27,9 +23,8 @@ class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=to def __init__( self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) kwargs.setdefault('sdk_moniker', 'basic-sample/{}'.format(VERSION)) diff --git a/docs/samples/specification/basic/generated/azure/basic/sample/operations/_http_success_operations.py b/docs/samples/specification/basic/generated/azure/basic/sample/operations/_http_success_operations.py index 947c2560aed..e33ba7ab862 100644 --- a/docs/samples/specification/basic/generated/azure/basic/sample/operations/_http_success_operations.py +++ b/docs/samples/specification/basic/generated/azure/basic/sample/operations/_http_success_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -16,21 +16,16 @@ from .._serialization import Serializer from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/200") @@ -42,9 +37,8 @@ def build_head200_request( def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/204") @@ -56,9 +50,8 @@ def build_head204_request( def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/404") @@ -68,8 +61,7 @@ def build_head404_request( **kwargs ) -# fmt: on -class HttpSuccessOperations(object): +class HttpSuccessOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -90,9 +82,8 @@ def __init__(self, *args, **kwargs): @distributed_trace def head200( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -140,9 +131,8 @@ def head200( # pylint: disable=inconsistent-return-statements @distributed_trace def head204( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -190,9 +180,8 @@ def head204( # pylint: disable=inconsistent-return-statements @distributed_trace def head404( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/_configuration.py b/docs/samples/specification/directives/generated/azure/directives/sample/_configuration.py index ba6eb9dc80f..acdfe154b34 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/_configuration.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/_configuration.py @@ -6,17 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any from azure.core.configuration import Configuration from azure.core.pipeline import policies from ._version import VERSION -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - class PollingPagingExampleConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for PollingPagingExample. @@ -27,9 +23,8 @@ class PollingPagingExampleConfiguration(Configuration): # pylint: disable=too-m def __init__( self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: super(PollingPagingExampleConfiguration, self).__init__(**kwargs) kwargs.setdefault('sdk_moniker', 'directives-sample/{}'.format(VERSION)) diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/_polling_paging_example.py b/docs/samples/specification/directives/generated/azure/directives/sample/_polling_paging_example.py index c9e7b0d57ed..48ddae3945f 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/_polling_paging_example.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/_polling_paging_example.py @@ -7,21 +7,16 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse from . import models from ._configuration import PollingPagingExampleConfiguration from ._serialization import Deserializer, Serializer from .operations import PollingPagingExampleOperationsMixin -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.rest import HttpRequest, HttpResponse - class PollingPagingExample(PollingPagingExampleOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Show polling and paging generation. @@ -33,10 +28,9 @@ class PollingPagingExample(PollingPagingExampleOperationsMixin): # pylint: disa def __init__( self, - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = PollingPagingExampleConfiguration(**kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -48,10 +42,9 @@ def __init__( def _send_request( self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/_vendor.py b/docs/samples/specification/directives/generated/azure/directives/sample/_vendor.py index 9a223d15524..a62f2520b17 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/_vendor.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/_vendor.py @@ -5,11 +5,29 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import PollingPagingExampleConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from ._serialization import Deserializer, Serializer + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) if files: request.set_formdata_body(files) return request + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "PipelineClient" + _config: PollingPagingExampleConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/aio/_vendor.py b/docs/samples/specification/directives/generated/azure/directives/sample/aio/_vendor.py new file mode 100644 index 00000000000..a22c70555a1 --- /dev/null +++ b/docs/samples/specification/directives/generated/azure/directives/sample/aio/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import PollingPagingExampleConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from .._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "AsyncPipelineClient" + _config: PollingPagingExampleConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py b/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py index b60b6e6de49..c68a2dae945 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/aio/operations/_polling_paging_example_operations.py @@ -22,10 +22,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._polling_paging_example_operations import build_basic_paging_request, build_basic_polling_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class PollingPagingExampleOperationsMixin: +class PollingPagingExampleOperationsMixin(MixinABC): async def _basic_polling_initial( self, diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/models/__init__.py b/docs/samples/specification/directives/generated/azure/directives/sample/models/__init__.py index 623047ab9c4..e01b3a4ef87 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/models/__init__.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/models/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Error - from ._models_py3 import Product - from ._models_py3 import ProductProperties - from ._models_py3 import ProductResult -except (SyntaxError, ImportError): - from ._models import Error # type: ignore - from ._models import Product # type: ignore - from ._models import ProductProperties # type: ignore - from ._models import ProductResult # type: ignore +from ._models_py3 import Error +from ._models_py3 import Product +from ._models_py3 import ProductProperties +from ._models_py3 import ProductResult from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/models/_models.py b/docs/samples/specification/directives/generated/azure/directives/sample/models/_models.py deleted file mode 100644 index ead7a222c1d..00000000000 --- a/docs/samples/specification/directives/generated/azure/directives/sample/models/_models.py +++ /dev/null @@ -1,120 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from .. import _serialization - - -class Error(_serialization.Model): - """Error. - - :ivar status: - :vartype status: int - :ivar message: - :vartype message: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: - :paramtype status: int - :keyword message: - :paramtype message: str - """ - super(Error, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.message = kwargs.get('message', None) - - -class Product(_serialization.Model): - """Product. - - :ivar properties: - :vartype properties: ~azure.directives.sample.models.ProductProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ProductProperties"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword properties: - :paramtype properties: ~azure.directives.sample.models.ProductProperties - """ - super(Product, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ProductProperties(_serialization.Model): - """ProductProperties. - - :ivar id: - :vartype id: int - :ivar name: - :vartype name: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "int"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: - :paramtype id: int - :keyword name: - :paramtype name: str - """ - super(ProductProperties, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - - -class ProductResult(_serialization.Model): - """ProductResult. - - :ivar value: - :vartype value: list[~azure.directives.sample.models.Product] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword value: - :paramtype value: list[~azure.directives.sample.models.Product] - :keyword next_link: - :paramtype next_link: str - """ - super(ProductResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) diff --git a/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py b/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py index 8a5156e0b47..ad502f1eaa0 100644 --- a/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py +++ b/docs/samples/specification/directives/generated/azure/directives/sample/operations/_polling_paging_example_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import IO, Optional, TYPE_CHECKING, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -19,22 +19,17 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_basic_polling_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] @@ -57,9 +52,8 @@ def build_basic_polling_request( def build_basic_paging_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop('Accept', "application/json") @@ -77,15 +71,13 @@ def build_basic_paging_request( **kwargs ) -# fmt: on -class PollingPagingExampleOperationsMixin(object): +class PollingPagingExampleOperationsMixin(MixinABC): def _basic_polling_initial( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> Optional[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> Optional[_models.Product]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -147,10 +139,11 @@ def _basic_polling_initial( @overload def begin_basic_polling( self, - product=None, # type: Optional[_models.Product] - **kwargs # type: Any - ): - # type: (...) -> CustomPoller[_models.Product] + product: Optional[_models.Product] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CustomPoller[_models.Product]: """A simple polling operation. :param product: Product to put. Default value is None. @@ -174,10 +167,11 @@ def begin_basic_polling( @overload def begin_basic_polling( self, - product=None, # type: Optional[IO] - **kwargs # type: Any - ): - # type: (...) -> CustomPoller[_models.Product] + product: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CustomPoller[_models.Product]: """A simple polling operation. :param product: Product to put. Default value is None. @@ -202,10 +196,9 @@ def begin_basic_polling( @distributed_trace def begin_basic_polling( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> CustomPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> CustomPoller[_models.Product]: """A simple polling operation. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -277,9 +270,8 @@ def get_long_running_output(pipeline_response): @distributed_trace def basic_paging( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.Product"] + **kwargs: Any + ) -> Iterable["_models.Product"]: """A simple paging operation. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py b/docs/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py index 9114ff60c1f..2a0eea35ad4 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py @@ -7,8 +7,9 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from ._configuration import AutoRestHeadTestServiceConfiguration @@ -17,12 +18,11 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict + from typing import Dict from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-version-keyword +class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. :ivar http_success: HttpSuccessOperations operations @@ -35,11 +35,10 @@ class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-ver def __init__( self, - credential, # type: "TokenCredential" - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -54,10 +53,9 @@ def __init__( def _send_request( self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/_configuration.py b/docs/samples/specification/management/generated/azure/mgmt/sample/_configuration.py index fb6d18856c3..019a9964462 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/_configuration.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,8 +16,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -33,10 +31,9 @@ class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=to def __init__( self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/docs/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py b/docs/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py index 923a318d016..64c644a5ef8 100644 --- a/docs/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py +++ b/docs/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,21 +17,16 @@ from .._serialization import Serializer from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/200") @@ -43,9 +38,8 @@ def build_head200_request( def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/204") @@ -57,9 +51,8 @@ def build_head204_request( def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/404") @@ -69,8 +62,7 @@ def build_head404_request( **kwargs ) -# fmt: on -class HttpSuccessOperations(object): +class HttpSuccessOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -91,9 +83,8 @@ def __init__(self, *args, **kwargs): @distributed_trace def head200( self, - **kwargs # type: Any - ): - # type: (...) -> bool + **kwargs: Any + ) -> bool: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -142,9 +133,8 @@ def head200( @distributed_trace def head204( self, - **kwargs # type: Any - ): - # type: (...) -> bool + **kwargs: Any + ) -> bool: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -193,9 +183,8 @@ def head204( @distributed_trace def head404( self, - **kwargs # type: Any - ): - # type: (...) -> bool + **kwargs: Any + ) -> bool: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_configuration.py index ff05526c648..213d7333122 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -18,8 +18,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class MultiapiServiceClientConfiguration(Configuration): @@ -34,7 +32,7 @@ class MultiapiServiceClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py index bbaa08bd2f3..714889ae678 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition @@ -21,8 +21,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -68,9 +66,9 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", api_version=None, # type: Optional[str] - base_url="http://localhost:3000", # type: str + base_url: str = "http://localhost:3000", profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_operations_mixin.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_operations_mixin.py index 9cfdaa42182..99727decab8 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_operations_mixin.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_operations_mixin.py @@ -9,26 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer -from typing import IO, Optional, TYPE_CHECKING, Union +from typing import Any, IO, Iterable, Optional, Union from azure.core.paging import ItemPaged from azure.core.polling import LROPoller from . import models as _models -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable - class MultiapiServiceClientOperationsMixin(object): def begin_test_lro( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -63,11 +58,10 @@ def begin_test_lro( def begin_test_lro_and_paging( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Iterable["_models.Product"]] + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.Product"]]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: Default value is None. @@ -103,12 +97,11 @@ def begin_test_lro_and_paging( def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - greeting_in_chinese=None, # type: Optional[str] - greeting_in_french=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. @@ -141,11 +134,10 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements def test_one( # pylint: disable=inconsistent-return-statements self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """TestOne should be in an FirstVersionOperationsMixin. :param id: An int parameter. Required. @@ -174,9 +166,8 @@ def test_one( # pylint: disable=inconsistent-return-statements def test_paging( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ModelThree"] + **kwargs: Any + ) -> Iterable["_models.ModelThree"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_configuration.py index fc4d4ffcb91..388500d68ee 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -14,8 +14,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential VERSION = "unknown" @@ -35,10 +33,9 @@ class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too- def __init__( self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(MultiapiServiceClientConfiguration, self).__init__(**kwargs) api_version = kwargs.pop('api_version', "1.0.0") # type: str diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_metadata.json b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_metadata.json index 11a3018f436..1cb7896f51f 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_metadata.json +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -93,7 +93,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"TestOne should be in an FirstVersionOperationsMixin.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -106,7 +106,7 @@ }, "_test_lro_initial" : { "sync": { - "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[_models.Product]\n", + "signature": "def _test_lro_initial(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e Optional[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~azure.multiapi.sample.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product or None or the result of cls(response)\n:rtype: ~azure.multiapi.sample.v1.models.Product or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -119,7 +119,7 @@ }, "begin_test_lro" : { "sync": { - "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[_models.Product]\n", + "signature": "def begin_test_lro(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~azure.multiapi.sample.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~azure.multiapi.sample.v1.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -132,7 +132,7 @@ }, "_test_lro_and_paging_initial" : { "sync": { - "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.PagingResult\n", + "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e _models.PagingResult:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~azure.multiapi.sample.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult or the result of cls(response)\n:rtype: ~azure.multiapi.sample.v1.models.PagingResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -145,7 +145,7 @@ }, "begin_test_lro_and_paging" : { "sync": { - "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[Iterable[\"_models.Product\"]]\n", + "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.Product\"]]:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~azure.multiapi.sample.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult\n or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~azure.multiapi.sample.v1.models.Product]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -158,7 +158,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, **kwargs" }, diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_multiapi_service_client.py index cb9c56980f3..6a5c217b64a 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_multiapi_service_client.py @@ -7,8 +7,9 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models @@ -18,10 +19,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse class MultiapiServiceClient(MultiapiServiceClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for multiapi client testing. @@ -41,11 +39,10 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin): # pylint: di def __init__( self, - credential, # type: "TokenCredential" - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MultiapiServiceClientConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -60,10 +57,9 @@ def __init__( def _send_request( self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_vendor.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_vendor.py index 9a223d15524..fc1f3b4c411 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_vendor.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/_vendor.py @@ -5,11 +5,29 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import MultiapiServiceClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) if files: request.set_formdata_body(files) return request + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "PipelineClient" + _config: MultiapiServiceClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_vendor.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_vendor.py new file mode 100644 index 00000000000..c2adede4a23 --- /dev/null +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import MultiapiServiceClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "AsyncPipelineClient" + _config: MultiapiServiceClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py index 3eddf451ba7..6e2860e69dd 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py @@ -23,10 +23,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_lro_and_paging_request, build_test_lro_request, build_test_one_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class MultiapiServiceClientOperationsMixin: +class MultiapiServiceClientOperationsMixin(MixinABC): @distributed_trace_async async def test_one( # pylint: disable=inconsistent-return-statements diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py index d1235165277..42311c29e08 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py @@ -19,6 +19,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operation_group_one_operations import build_test_two_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/models/__init__.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/models/__init__.py index 9e88aa357aa..134ebf1ea8f 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/models/__init__.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/models/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Error - from ._models_py3 import PagingResult - from ._models_py3 import Product - from ._models_py3 import TestLroAndPagingOptions -except (SyntaxError, ImportError): - from ._models import Error # type: ignore - from ._models import PagingResult # type: ignore - from ._models import Product # type: ignore - from ._models import TestLroAndPagingOptions # type: ignore +from ._models_py3 import Error +from ._models_py3 import PagingResult +from ._models_py3 import Product +from ._models_py3 import TestLroAndPagingOptions from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/models/_models.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/models/_models.py deleted file mode 100644 index cff86725c2b..00000000000 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/models/_models.py +++ /dev/null @@ -1,122 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ... import _serialization - - -class Error(_serialization.Model): - """Error. - - :ivar status: - :vartype status: int - :ivar message: - :vartype message: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: - :paramtype status: int - :keyword message: - :paramtype message: str - """ - super(Error, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.message = kwargs.get('message', None) - - -class PagingResult(_serialization.Model): - """PagingResult. - - :ivar values: - :vartype values: list[~azure.multiapi.sample.v1.models.Product] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "values": {"key": "values", "type": "[Product]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword values: - :paramtype values: list[~azure.multiapi.sample.v1.models.Product] - :keyword next_link: - :paramtype next_link: str - """ - super(PagingResult, self).__init__(**kwargs) - self.values = kwargs.get('values', None) - self.next_link = kwargs.get('next_link', None) - - -class Product(_serialization.Model): - """Product. - - :ivar id: - :vartype id: int - """ - - _attribute_map = { - "id": {"key": "id", "type": "int"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: - :paramtype id: int - """ - super(Product, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class TestLroAndPagingOptions(_serialization.Model): - """Parameter group. - - :ivar maxresults: Sets the maximum number of items to return in the response. - :vartype maxresults: int - :ivar timeout: Sets the maximum time that the server can spend processing the request, in - seconds. The default is 30 seconds. - :vartype timeout: int - """ - - _attribute_map = { - "maxresults": {"key": "maxresults", "type": "int"}, - "timeout": {"key": "timeout", "type": "int"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword maxresults: Sets the maximum number of items to return in the response. - :paramtype maxresults: int - :keyword timeout: Sets the maximum time that the server can spend processing the request, in - seconds. The default is 30 seconds. - :paramtype timeout: int - """ - super(TestLroAndPagingOptions, self).__init__(**kwargs) - self.maxresults = kwargs.get('maxresults', None) - self.timeout = kwargs.get('timeout', 30) diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py index cc41ae2ecb3..aba60c27250 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import IO, Optional, TYPE_CHECKING, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -21,28 +21,24 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_test_one_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, + id: int, + message: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "1.0.0")) # type: str - id = kwargs.pop('id') # type: int - message = kwargs.pop('message', _params.pop('message', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") # Construct URL @@ -67,9 +63,8 @@ def build_test_one_request( def build_test_lro_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] @@ -92,14 +87,14 @@ def build_test_lro_request( def build_test_lro_and_paging_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, + client_request_id: Optional[str] = None, + maxresults: Optional[int] = None, + timeout: int = 30, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - client_request_id = kwargs.pop('client_request_id', _headers.pop('client-request-id', None)) # type: Optional[str] - maxresults = kwargs.pop('maxresults', _headers.pop('maxresults', None)) # type: Optional[int] - timeout = kwargs.pop('timeout', _headers.pop('timeout', 30)) # type: int accept = _headers.pop('Accept', "application/json") # Construct URL @@ -123,14 +118,14 @@ def build_test_lro_and_paging_request( def build_test_different_calls_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, + greeting_in_english: str, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "1.0.0")) # type: str - greeting_in_english = kwargs.pop('greeting_in_english') # type: str accept = _headers.pop('Accept', "application/json") # Construct URL @@ -151,17 +146,15 @@ def build_test_different_calls_request( **kwargs ) -# fmt: on -class MultiapiServiceClientOperationsMixin(object): +class MultiapiServiceClientOperationsMixin(MixinABC): @distributed_trace def test_one( # pylint: disable=inconsistent-return-statements self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """TestOne should be in an FirstVersionOperationsMixin. :param id: An int parameter. Required. @@ -217,10 +210,9 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> Optional[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> Optional[_models.Product]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -282,10 +274,11 @@ def _test_lro_initial( @overload def begin_test_lro( self, - product=None, # type: Optional[_models.Product] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[_models.Product] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Default value is None. @@ -309,10 +302,11 @@ def begin_test_lro( @overload def begin_test_lro( self, - product=None, # type: Optional[IO] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Default value is None. @@ -337,10 +331,9 @@ def begin_test_lro( @distributed_trace def begin_test_lro( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -411,11 +404,10 @@ def get_long_running_output(pipeline_response): def _test_lro_and_paging_initial( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> _models.PagingResult + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> _models.PagingResult: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -468,11 +460,10 @@ def _test_lro_and_paging_initial( @distributed_trace def begin_test_lro_and_paging( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Iterable["_models.Product"]] + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.Product"]]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: Default value is None. @@ -617,10 +608,9 @@ def internal_get_next(next_link=None): @distributed_trace def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py index cb6655b3c64..e4018796925 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -18,22 +18,17 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_test_two_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -57,8 +52,7 @@ def build_test_two_request( **kwargs ) -# fmt: on -class OperationGroupOneOperations(object): +class OperationGroupOneOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -81,9 +75,8 @@ def __init__(self, *args, **kwargs): @distributed_trace def test_two( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """TestTwo should be in OperationGroupOneOperations. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_configuration.py index 93db2ae1fa4..5307829d9a2 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -14,8 +14,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential VERSION = "unknown" @@ -35,10 +33,9 @@ class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too- def __init__( self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(MultiapiServiceClientConfiguration, self).__init__(**kwargs) api_version = kwargs.pop('api_version', "2.0.0") # type: str diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_metadata.json b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_metadata.json index f235c8ab6ed..5033eed3611 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_metadata.json +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.ModelTwo\n", + "signature": "def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e _models.ModelTwo:\n", "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo or the result of cls(response)\n:rtype: ~azure.multiapi.sample.v2.models.ModelTwo\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, **kwargs" }, diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_multiapi_service_client.py index c768cc7cd53..6cb5c3b1f09 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_multiapi_service_client.py @@ -7,8 +7,9 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models @@ -18,10 +19,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse class MultiapiServiceClient(MultiapiServiceClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for multiapi client testing. @@ -41,11 +39,10 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin): # pylint: di def __init__( self, - credential, # type: "TokenCredential" - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MultiapiServiceClientConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -63,10 +60,9 @@ def __init__( def _send_request( self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_vendor.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_vendor.py index 9a223d15524..fc1f3b4c411 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_vendor.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/_vendor.py @@ -5,11 +5,29 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import MultiapiServiceClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) if files: request.set_formdata_body(files) return request + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "PipelineClient" + _config: MultiapiServiceClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_vendor.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_vendor.py new file mode 100644 index 00000000000..c2adede4a23 --- /dev/null +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import MultiapiServiceClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "AsyncPipelineClient" + _config: MultiapiServiceClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py index ac113a56679..4a8e606fdd7 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py @@ -19,10 +19,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_one_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class MultiapiServiceClientOperationsMixin: +class MultiapiServiceClientOperationsMixin(MixinABC): @distributed_trace_async async def test_one( diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py index 2d55835484b..d7106853c12 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py @@ -19,6 +19,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operation_group_one_operations import build_test_three_request, build_test_two_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py index d6e2d1e6a56..1564a369318 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py @@ -19,6 +19,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operation_group_two_operations import build_test_four_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/models/__init__.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/models/__init__.py index 16b579ceba6..8a114791bc4 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/models/__init__.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/models/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Error - from ._models_py3 import ModelTwo -except (SyntaxError, ImportError): - from ._models import Error # type: ignore - from ._models import ModelTwo # type: ignore +from ._models_py3 import Error +from ._models_py3 import ModelTwo from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/models/_models.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/models/_models.py deleted file mode 100644 index 44f5fa31416..00000000000 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/models/_models.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ... import _serialization - - -class Error(_serialization.Model): - """Error. - - :ivar status: - :vartype status: int - :ivar message: - :vartype message: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: - :paramtype status: int - :keyword message: - :paramtype message: str - """ - super(Error, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.message = kwargs.get('message', None) - - -class ModelTwo(_serialization.Model): - """Only exists in api version 2.0.0. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Required. - :vartype id: int - :ivar message: - :vartype message: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "int"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: Required. - :paramtype id: int - :keyword message: - :paramtype message: str - """ - super(ModelTwo, self).__init__(**kwargs) - self.id = kwargs['id'] - self.message = kwargs.get('message', None) diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py index e05591d9fab..c5d10b4ac4a 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Optional, TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -18,28 +18,24 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_test_one_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, + id: int, + message: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0.0")) # type: str - id = kwargs.pop('id') # type: int - message = kwargs.pop('message', _params.pop('message', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") # Construct URL @@ -64,15 +60,15 @@ def build_test_one_request( def build_test_different_calls_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0.0")) # type: str - greeting_in_english = kwargs.pop('greeting_in_english') # type: str - greeting_in_chinese = kwargs.pop('greeting_in_chinese', _headers.pop('greetingInChinese', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") # Construct URL @@ -95,17 +91,15 @@ def build_test_different_calls_request( **kwargs ) -# fmt: on -class MultiapiServiceClientOperationsMixin(object): +class MultiapiServiceClientOperationsMixin(MixinABC): @distributed_trace def test_one( self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> _models.ModelTwo + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> _models.ModelTwo: """TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo. :param id: An int parameter. Required. @@ -166,11 +160,10 @@ def test_one( @distributed_trace def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - greeting_in_chinese=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py index 38f361f2d1f..561553c0275 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import IO, Optional, TYPE_CHECKING, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -18,22 +18,17 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_test_two_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -62,9 +57,8 @@ def build_test_two_request( def build_test_three_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -88,8 +82,7 @@ def build_test_three_request( **kwargs ) -# fmt: on -class OperationGroupOneOperations(object): +class OperationGroupOneOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -112,10 +105,11 @@ def __init__(self, *args, **kwargs): @overload def test_two( self, - parameter_one=None, # type: Optional[_models.ModelTwo] - **kwargs # type: Any - ): - # type: (...) -> _models.ModelTwo + parameter_one: Optional[_models.ModelTwo] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ModelTwo: """TestTwo should be in OperationGroupOneOperations. Takes in ModelTwo and ouputs ModelTwo. :param parameter_one: A ModelTwo parameter. Default value is None. @@ -132,10 +126,11 @@ def test_two( @overload def test_two( self, - parameter_one=None, # type: Optional[IO] - **kwargs # type: Any - ): - # type: (...) -> _models.ModelTwo + parameter_one: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ModelTwo: """TestTwo should be in OperationGroupOneOperations. Takes in ModelTwo and ouputs ModelTwo. :param parameter_one: A ModelTwo parameter. Default value is None. @@ -153,10 +148,9 @@ def test_two( @distributed_trace def test_two( self, - parameter_one=None, # type: Optional[Union[_models.ModelTwo, IO]] - **kwargs # type: Any - ): - # type: (...) -> _models.ModelTwo + parameter_one: Optional[Union[_models.ModelTwo, IO]] = None, + **kwargs: Any + ) -> _models.ModelTwo: """TestTwo should be in OperationGroupOneOperations. Takes in ModelTwo and ouputs ModelTwo. :param parameter_one: A ModelTwo parameter. Is either a model type or a IO type. Default value @@ -231,9 +225,8 @@ def test_two( @distributed_trace def test_three( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """TestThree should be in OperationGroupOneOperations. Takes in ModelTwo. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py index b3e89761f07..3ac006d9a86 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -18,27 +18,23 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_test_four_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, + parameter_one: bool, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0.0")) # type: str - parameter_one = kwargs.pop('parameter_one') # type: bool accept = _headers.pop('Accept', "application/json") # Construct URL @@ -59,8 +55,7 @@ def build_test_four_request( **kwargs ) -# fmt: on -class OperationGroupTwoOperations(object): +class OperationGroupTwoOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -83,10 +78,9 @@ def __init__(self, *args, **kwargs): @distributed_trace def test_four( # pylint: disable=inconsistent-return-statements self, - parameter_one, # type: bool - **kwargs # type: Any - ): - # type: (...) -> None + parameter_one: bool, + **kwargs: Any + ) -> None: """TestFour should be in OperationGroupTwoOperations. :param parameter_one: A boolean parameter. Required. diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_configuration.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_configuration.py index bda9a41b543..3382ad62199 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_configuration.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -14,8 +14,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential VERSION = "unknown" @@ -35,10 +33,9 @@ class MultiapiServiceClientConfiguration(Configuration): # pylint: disable=too- def __init__( self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + **kwargs: Any + ) -> None: super(MultiapiServiceClientConfiguration, self).__init__(**kwargs) api_version = kwargs.pop('api_version', "3.0.0") # type: str diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_metadata.json b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_metadata.json index 76d17642086..4e3104efef4 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_metadata.json +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_paging" : { "sync": { - "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n # type: (...) -\u003e Iterable[\"_models.ModelThree\"]\n", + "signature": "def test_paging(\n self,\n **kwargs: Any\n) -\u003e Iterable[\"_models.ModelThree\"]:\n", "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either ModelThree or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.multiapi.sample.v3.models.ModelThree]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "**kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test. Default value is None.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs" }, diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py index 426944574c6..32239b76772 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_multiapi_service_client.py @@ -7,8 +7,9 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from . import models @@ -18,10 +19,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse class MultiapiServiceClient(MultiapiServiceClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for multiapi client testing. @@ -41,11 +39,10 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin): # pylint: di def __init__( self, - credential, # type: "TokenCredential" - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + base_url: str = "http://localhost:3000", + **kwargs: Any + ) -> None: self._config = MultiapiServiceClientConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -63,10 +60,9 @@ def __init__( def _send_request( self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_vendor.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_vendor.py index 9a223d15524..fc1f3b4c411 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_vendor.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/_vendor.py @@ -5,11 +5,29 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import MultiapiServiceClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from .._serialization import Deserializer, Serializer + def _convert_request(request, files=None): data = request.content if not files else None request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) if files: request.set_formdata_body(files) return request + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "PipelineClient" + _config: MultiapiServiceClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_vendor.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_vendor.py new file mode 100644 index 00000000000..c2adede4a23 --- /dev/null +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import MultiapiServiceClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from ..._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + _client: "AsyncPipelineClient" + _config: MultiapiServiceClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py index 55fc2b58c1f..ff15eabcbe7 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py @@ -21,10 +21,11 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_paging_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class MultiapiServiceClientOperationsMixin: +class MultiapiServiceClientOperationsMixin(MixinABC): @distributed_trace def test_paging( diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py index 0ff1a7e7796..dc7da480048 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py @@ -19,6 +19,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operation_group_one_operations import build_test_two_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py index 465d476d973..e238045a619 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py @@ -19,6 +19,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operation_group_two_operations import build_test_five_request, build_test_four_request +from .._vendor import MixinABC T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/__init__.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/__init__.py index c525075f16f..5fdae05688a 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/__init__.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Error - from ._models_py3 import ModelThree - from ._models_py3 import PagingResult - from ._models_py3 import SourcePath -except (SyntaxError, ImportError): - from ._models import Error # type: ignore - from ._models import ModelThree # type: ignore - from ._models import PagingResult # type: ignore - from ._models import SourcePath # type: ignore +from ._models_py3 import Error +from ._models_py3 import ModelThree +from ._models_py3 import PagingResult +from ._models_py3 import SourcePath from ._multiapi_service_client_enums import ContentType from ._patch import __all__ as _patch_all diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/_models.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/_models.py deleted file mode 100644 index 888eb9b4c84..00000000000 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/models/_models.py +++ /dev/null @@ -1,118 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ... import _serialization - - -class Error(_serialization.Model): - """Error. - - :ivar status: - :vartype status: int - :ivar message: - :vartype message: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword status: - :paramtype status: int - :keyword message: - :paramtype message: str - """ - super(Error, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.message = kwargs.get('message', None) - - -class ModelThree(_serialization.Model): - """Only exists in api version 3.0.0. - - :ivar optional_property: - :vartype optional_property: str - """ - - _attribute_map = { - "optional_property": {"key": "optionalProperty", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword optional_property: - :paramtype optional_property: str - """ - super(ModelThree, self).__init__(**kwargs) - self.optional_property = kwargs.get('optional_property', None) - - -class PagingResult(_serialization.Model): - """PagingResult. - - :ivar values: - :vartype values: list[~azure.multiapi.sample.v3.models.ModelThree] - :ivar next_link: - :vartype next_link: str - """ - - _attribute_map = { - "values": {"key": "values", "type": "[ModelThree]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword values: - :paramtype values: list[~azure.multiapi.sample.v3.models.ModelThree] - :keyword next_link: - :paramtype next_link: str - """ - super(PagingResult, self).__init__(**kwargs) - self.values = kwargs.get('values', None) - self.next_link = kwargs.get('next_link', None) - - -class SourcePath(_serialization.Model): - """Uri or local path to source data. - - :ivar source: File source path. - :vartype source: str - """ - - _validation = { - 'source': {'max_length': 2048}, - } - - _attribute_map = { - "source": {"key": "source", "type": "str"}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword source: File source path. - :paramtype source: str - """ - super(SourcePath, self).__init__(**kwargs) - self.source = kwargs.get('source', None) diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py index c7f0c5100f0..cee2ae7e9f6 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Optional, TYPE_CHECKING +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,22 +19,17 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_test_paging_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) accept = _headers.pop('Accept', "application/json") @@ -54,16 +49,16 @@ def build_test_paging_request( def build_test_different_calls_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version = kwargs.pop('api_version', _params.pop('api-version', "3.0.0")) # type: str - greeting_in_english = kwargs.pop('greeting_in_english') # type: str - greeting_in_chinese = kwargs.pop('greeting_in_chinese', _headers.pop('greetingInChinese', None)) # type: Optional[str] - greeting_in_french = kwargs.pop('greeting_in_french', _headers.pop('greetingInFrench', None)) # type: Optional[str] accept = _headers.pop('Accept', "application/json") # Construct URL @@ -88,15 +83,13 @@ def build_test_different_calls_request( **kwargs ) -# fmt: on -class MultiapiServiceClientOperationsMixin(object): +class MultiapiServiceClientOperationsMixin(MixinABC): @distributed_trace def test_paging( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ModelThree"] + **kwargs: Any + ) -> Iterable["_models.ModelThree"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -168,12 +161,11 @@ def get_next(next_link=None): @distributed_trace def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - greeting_in_chinese=None, # type: Optional[str] - greeting_in_french=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py index efd906cbe6a..10ce50cdf5f 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import IO, Optional, TYPE_CHECKING, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -18,22 +18,17 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_test_two_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -60,8 +55,7 @@ def build_test_two_request( **kwargs ) -# fmt: on -class OperationGroupOneOperations(object): +class OperationGroupOneOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -84,10 +78,11 @@ def __init__(self, *args, **kwargs): @overload def test_two( self, - parameter_one=None, # type: Optional[_models.ModelThree] - **kwargs # type: Any - ): - # type: (...) -> _models.ModelThree + parameter_one: Optional[_models.ModelThree] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ModelThree: """TestTwo should be in OperationGroupOneOperations. Takes in ModelThree and ouputs ModelThree. :param parameter_one: A ModelThree parameter. Default value is None. @@ -104,10 +99,11 @@ def test_two( @overload def test_two( self, - parameter_one=None, # type: Optional[IO] - **kwargs # type: Any - ): - # type: (...) -> _models.ModelThree + parameter_one: Optional[IO] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ModelThree: """TestTwo should be in OperationGroupOneOperations. Takes in ModelThree and ouputs ModelThree. :param parameter_one: A ModelThree parameter. Default value is None. @@ -125,10 +121,9 @@ def test_two( @distributed_trace def test_two( self, - parameter_one=None, # type: Optional[Union[_models.ModelThree, IO]] - **kwargs # type: Any - ): - # type: (...) -> _models.ModelThree + parameter_one: Optional[Union[_models.ModelThree, IO]] = None, + **kwargs: Any + ) -> _models.ModelThree: """TestTwo should be in OperationGroupOneOperations. Takes in ModelThree and ouputs ModelThree. :param parameter_one: A ModelThree parameter. Is either a model type or a IO type. Default diff --git a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py index cb493e09d53..cc6f93bfa5b 100644 --- a/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py +++ b/docs/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import IO, Optional, TYPE_CHECKING, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -18,22 +18,17 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import MixinABC, _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off + def build_test_four_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -62,9 +57,8 @@ def build_test_four_request( def build_test_five_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -88,8 +82,7 @@ def build_test_five_request( **kwargs ) -# fmt: on -class OperationGroupTwoOperations(object): +class OperationGroupTwoOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -112,10 +105,11 @@ def __init__(self, *args, **kwargs): @overload def test_four( # pylint: disable=inconsistent-return-statements self, - input=None, # type: Optional[_models.SourcePath] - **kwargs # type: Any - ): - # type: (...) -> None + input: Optional[_models.SourcePath] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: """TestFour should be in OperationGroupTwoOperations. :param input: Input parameter. Default value is None. @@ -132,10 +126,11 @@ def test_four( # pylint: disable=inconsistent-return-statements @overload def test_four( # pylint: disable=inconsistent-return-statements self, - input=None, # type: Optional[IO] - **kwargs # type: Any - ): - # type: (...) -> None + input: Optional[IO] = None, + *, + content_type: Optional[str] = None, + **kwargs: Any + ) -> None: """TestFour should be in OperationGroupTwoOperations. :param input: Input parameter. Default value is None. @@ -154,10 +149,9 @@ def test_four( # pylint: disable=inconsistent-return-statements @distributed_trace def test_four( # pylint: disable=inconsistent-return-statements self, - input=None, # type: Optional[Union[_models.SourcePath, IO]] - **kwargs # type: Any - ): - # type: (...) -> None + input: Optional[Union[_models.SourcePath, IO]] = None, + **kwargs: Any + ) -> None: """TestFour should be in OperationGroupTwoOperations. :param input: Input parameter. Is either a model type or a IO type. Default value is None. @@ -227,9 +221,8 @@ def test_four( # pylint: disable=inconsistent-return-statements @distributed_trace def test_five( # pylint: disable=inconsistent-return-statements self, - **kwargs # type: Any - ): - # type: (...) -> None + **kwargs: Any + ) -> None: """TestFive should be in OperationGroupTwoOperations. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/__init__.py index ee2e32bb258..2f5b5ccb585 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/__init__.py @@ -13,7 +13,6 @@ from ._models_py3 import ParameterGroupingPostOptionalParameters from ._models_py3 import ParameterGroupingPostRequiredParameters from ._models_py3 import ParameterGroupingPostReservedWordsParameters - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/__init__.py index 997dbfdeb30..7eaf5af1a83 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/__init__.py @@ -9,7 +9,6 @@ from ._models_py3 import Error from ._models_py3 import HeaderCustomNamedRequestIdParamGroupingParameters from ._models_py3 import OdataFilter - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/__init__.py index 6647ca7789e..e66ed8beed9 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/__init__.py @@ -19,7 +19,6 @@ from ._models_py3 import ProductResultValue from ._models_py3 import ProductResultValueWithXMSClientName - from ._auto_rest_paging_test_service_enums import OperationResultStatus from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py index 5328a3a6b3b..f8f3bd1a72e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py @@ -29,6 +29,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_get_no_item_name_pages_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/__init__.py index 17dc6e5abdb..d7566849809 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import Product from ._models_py3 import ProductProperties from ._models_py3 import ProductResult - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/__init__.py index 49d417e2d75..5922505434d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/__init__.py @@ -14,7 +14,6 @@ from ._models_py3 import SubProduct from ._models_py3 import SubResource - from ._auto_rest_long_running_operation_test_service_enums import OperationResultStatus from ._auto_rest_long_running_operation_test_service_enums import ProductPropertiesProvisioningStateValues from ._auto_rest_long_running_operation_test_service_enums import SubProductPropertiesProvisioningStateValues diff --git a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py index 4a29c48dbae..fdbe7846d99 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py @@ -7,8 +7,9 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from ._configuration import AutoRestHeadTestServiceConfiguration @@ -17,13 +18,12 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict + from typing import Dict from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-version-keyword +class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. :ivar http_success: HttpSuccessOperations operations @@ -34,13 +34,7 @@ class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-ver :type base_url: str """ - def __init__( - self, - credential, # type: "TokenCredential" - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -50,12 +44,7 @@ def __init__( self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_configuration.py index ee596fcf91a..28939d065a2 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,8 +16,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -31,12 +29,7 @@ class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=to :type credential: ~azure.core.credentials.TokenCredential """ - def __init__( - self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py index 9a68f694994..f3309800981 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,60 +24,35 @@ from .._serialization import Serializer from .._vendor import _convert_request -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - - T = TypeVar("T") - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + +def build_head200_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/200") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head204_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/204") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head404_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/404") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) + -# fmt: on -class HttpSuccessOperations(object): +class HttpSuccessOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -95,10 +70,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def head200( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head200(self, **kwargs: Any) -> bool: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -139,10 +111,7 @@ def head200( head200.metadata = {"url": "/http/success/200"} # type: ignore @distributed_trace - def head204( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head204(self, **kwargs: Any) -> bool: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -183,10 +152,7 @@ def head204( head204.metadata = {"url": "/http/success/204"} # type: ignore @distributed_trace - def head404( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head404(self, **kwargs: Any) -> bool: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py index 9766056b8ab..ff8b2f005d4 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py @@ -7,8 +7,9 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from ._configuration import AutoRestHeadTestServiceConfiguration @@ -17,13 +18,12 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict + from typing import Dict from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-version-keyword +class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. :ivar http_success: HttpSuccessOperations operations @@ -34,13 +34,7 @@ class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-ver :type base_url: str """ - def __init__( - self, - credential, # type: "TokenCredential" - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -50,12 +44,7 @@ def __init__( self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_configuration.py index c910a7d5062..15d7fe77e55 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,8 +16,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -31,12 +29,7 @@ class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=to :type credential: ~azure.core.credentials.TokenCredential """ - def __init__( - self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py index 1688d120e15..3a87c4bf87e 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,60 +24,35 @@ from .._serialization import Serializer from .._vendor import _convert_request -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - - T = TypeVar("T") - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + +def build_head200_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/200") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head204_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/204") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head404_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/404") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) + -# fmt: on -class HttpSuccessOperations(object): +class HttpSuccessOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -95,10 +70,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def head200( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head200(self, **kwargs: Any) -> bool: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -139,10 +111,7 @@ def head200( head200.metadata = {"url": "/http/success/200"} # type: ignore @distributed_trace - def head204( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head204(self, **kwargs: Any) -> bool: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -183,10 +152,7 @@ def head204( head204.metadata = {"url": "/http/success/204"} # type: ignore @distributed_trace - def head404( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head404(self, **kwargs: Any) -> bool: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py index 4ca03ad8af6..d3c6715ff8c 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py @@ -7,8 +7,9 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from ._configuration import AutoRestHeadTestServiceConfiguration @@ -17,13 +18,12 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict + from typing import Dict from azure.core.credentials import TokenCredential - from azure.core.rest import HttpRequest, HttpResponse -class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-version-keyword +class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. :ivar http_success: HttpSuccessOperations operations @@ -34,13 +34,7 @@ class AutoRestHeadTestService(object): # pylint: disable=client-accepts-api-ver :type base_url: str """ - def __init__( - self, - credential, # type: "TokenCredential" - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any) -> None: self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -50,12 +44,7 @@ def __init__( self._serialize.client_side_validation = False self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_configuration.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_configuration.py index 70801443070..2c735891913 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_configuration.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,8 +16,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -31,12 +29,7 @@ class AutoRestHeadTestServiceConfiguration(Configuration): # pylint: disable=to :type credential: ~azure.core.credentials.TokenCredential """ - def __init__( - self, - credential, # type: "TokenCredential" - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(AutoRestHeadTestServiceConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py b/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py index b2efda6413c..4b8370c0ea4 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,60 +24,35 @@ from .._serialization import Serializer from .._vendor import _convert_request -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - - T = TypeVar("T") - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + +def build_head200_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/200") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head204_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/204") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head404_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = kwargs.pop("template_url", "/http/success/404") - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) + -# fmt: on -class HttpSuccessOperations(object): +class HttpSuccessOperations: """ .. warning:: **DO NOT** instantiate this class directly. @@ -95,10 +70,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def head200( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head200(self, **kwargs: Any) -> bool: """Return 200 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -139,10 +111,7 @@ def head200( head200.metadata = {"url": "/http/success/200"} # type: ignore @distributed_trace - def head204( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head204(self, **kwargs: Any) -> bool: """Return 204 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response @@ -183,10 +152,7 @@ def head204( head204.metadata = {"url": "/http/success/204"} # type: ignore @distributed_trace - def head404( - self, **kwargs # type: Any - ): - # type: (...) -> bool + def head404(self, **kwargs: Any) -> bool: """Return 404 status code if successful. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/__init__.py index 7f8338fb99b..f5974b8c406 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/__init__.py @@ -19,7 +19,6 @@ from ._models_py3 import ProductResultValue from ._models_py3 import ProductResultValueWithXMSClientName - from ._auto_rest_paging_test_service_enums import OperationResultStatus from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/__init__.py index 12f9179bb75..ae472fcb549 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/__init__.py @@ -24,7 +24,6 @@ from ._models_py3 import UsageListResult from ._models_py3 import UsageName - from ._storage_management_client_enums import AccountStatus from ._storage_management_client_enums import AccountType from ._storage_management_client_enums import KeyName diff --git a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/__init__.py b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/__init__.py index 1b806ae8638..63846647f5a 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/__init__.py +++ b/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error from ._models_py3 import SampleResourceGroup - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_client.py index 38b2870513b..cf207cd4ee4 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py index 2551fd5500f..920665f48c7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_put_positive_duration_request - from ._request_builders_py3 import build_get_positive_duration_request - from ._request_builders_py3 import build_get_invalid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_put_positive_duration_request # type: ignore - from ._request_builders import build_get_positive_duration_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_put_positive_duration_request +from ._request_builders import build_get_positive_duration_request +from ._request_builders import build_get_invalid_request __all__ = [ "build_get_null_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py index 5e2205c0839..e178029cc3a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null duration value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/duration/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_positive_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_positive_duration_request(*, json: datetime.timedelta, **kwargs: Any) -> HttpRequest: """Put a positive duration value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -70,29 +58,21 @@ def build_put_positive_duration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/duration/positiveduration" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_positive_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_positive_duration_request(**kwargs: Any) -> HttpRequest: """Get a positive duration value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -106,26 +86,18 @@ def build_get_positive_duration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/duration/positiveduration" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get an invalid duration value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -139,17 +111,12 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/duration/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py deleted file mode 100644 index ba37135e278..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureBodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py +++ /dev/null @@ -1,154 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null duration value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/duration/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_positive_duration_request( - *, - json: datetime.timedelta, - **kwargs: Any -) -> HttpRequest: - """Put a positive duration value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: duration body. Required. - :paramtype json: ~datetime.timedelta - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/duration/positiveduration" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_positive_duration_request( - **kwargs: Any -) -> HttpRequest: - """Get a positive duration value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/duration/positiveduration" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get an invalid duration value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/duration/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_client.py index e4fb7896a81..64d5dbe8b2e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-ap """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestParameterGroupingTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/__init__.py index ef3d7335dcd..414f102a44d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/__init__.py @@ -6,20 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_post_required_request - from ._request_builders_py3 import build_post_optional_request - from ._request_builders_py3 import build_post_reserved_words_request - from ._request_builders_py3 import build_post_multi_param_groups_request - from ._request_builders_py3 import build_post_shared_parameter_group_object_request - from ._request_builders_py3 import build_group_with_constant_request -except (SyntaxError, ImportError): - from ._request_builders import build_post_required_request # type: ignore - from ._request_builders import build_post_optional_request # type: ignore - from ._request_builders import build_post_reserved_words_request # type: ignore - from ._request_builders import build_post_multi_param_groups_request # type: ignore - from ._request_builders import build_post_shared_parameter_group_object_request # type: ignore - from ._request_builders import build_group_with_constant_request # type: ignore +from ._request_builders import build_post_required_request +from ._request_builders import build_post_optional_request +from ._request_builders import build_post_reserved_words_request +from ._request_builders import build_post_multi_param_groups_request +from ._request_builders import build_post_shared_parameter_group_object_request +from ._request_builders import build_group_with_constant_request __all__ = [ "build_post_required_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py index 1b339dc6018..839ec8a133a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders.py @@ -16,13 +16,10 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_post_required_request( - path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + path: str, *, json: int, custom_header: Optional[str] = None, query: int = 30, **kwargs: Any +) -> HttpRequest: """Post a bunch of required parameters grouped. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -45,43 +42,32 @@ def build_post_required_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - custom_header = kwargs.pop('custom_header', _headers.pop('customHeader', None)) # type: Optional[str] - query = kwargs.pop('query', _params.pop('query', 30)) # type: int - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/parameterGrouping/postRequired/{path}" path_format_arguments = { - "path": _SERIALIZER.url("path", path, 'str'), + "path": _SERIALIZER.url("path", path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if query is not None: - _params['query'] = _SERIALIZER.query("query", query, 'int') + _params["query"] = _SERIALIZER.query("query", query, "int") # Construct headers if custom_header is not None: - _headers['customHeader'] = _SERIALIZER.header("custom_header", custom_header, 'str') + _headers["customHeader"] = _SERIALIZER.header("custom_header", custom_header, "str") if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_post_optional_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) + + +def build_post_optional_request(*, custom_header: Optional[str] = None, query: int = 30, **kwargs: Any) -> HttpRequest: """Post a bunch of optional parameters grouped. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,35 +86,26 @@ def build_post_optional_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - custom_header = kwargs.pop('custom_header', _headers.pop('customHeader', None)) # type: Optional[str] - query = kwargs.pop('query', _params.pop('query', 30)) # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/parameterGrouping/postOptional" # Construct parameters if query is not None: - _params['query'] = _SERIALIZER.query("query", query, 'int') + _params["query"] = _SERIALIZER.query("query", query, "int") # Construct headers if custom_header is not None: - _headers['customHeader'] = _SERIALIZER.header("custom_header", custom_header, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["customHeader"] = _SERIALIZER.header("custom_header", custom_header, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_post_reserved_words_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, from_parameter: Optional[str] = None, accept_parameter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Post a grouped parameters with reserved words. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -148,29 +125,26 @@ def build_post_reserved_words_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - from_parameter = kwargs.pop('from_parameter', _params.pop('from', None)) # type: Optional[str] - accept_parameter = kwargs.pop('accept_parameter', _params.pop('accept', None)) # type: Optional[str] # Construct URL _url = "/parameterGrouping/postReservedWords" # Construct parameters if from_parameter is not None: - _params['from'] = _SERIALIZER.query("from_parameter", from_parameter, 'str') + _params["from"] = _SERIALIZER.query("from_parameter", from_parameter, "str") if accept_parameter is not None: - _params['accept'] = _SERIALIZER.query("accept_parameter", accept_parameter, 'str') + _params["accept"] = _SERIALIZER.query("accept_parameter", accept_parameter, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) def build_post_multi_param_groups_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, + header_one: Optional[str] = None, + query_one: int = 30, + header_two: Optional[str] = None, + query_two: int = 30, + **kwargs: Any +) -> HttpRequest: """Post parameters from multiple different parameter groups. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -193,41 +167,30 @@ def build_post_multi_param_groups_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - header_one = kwargs.pop('header_one', _headers.pop('header-one', None)) # type: Optional[str] - query_one = kwargs.pop('query_one', _params.pop('query-one', 30)) # type: int - header_two = kwargs.pop('header_two', _headers.pop('header-two', None)) # type: Optional[str] - query_two = kwargs.pop('query_two', _params.pop('query-two', 30)) # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/parameterGrouping/postMultipleParameterGroups" # Construct parameters if query_one is not None: - _params['query-one'] = _SERIALIZER.query("query_one", query_one, 'int') + _params["query-one"] = _SERIALIZER.query("query_one", query_one, "int") if query_two is not None: - _params['query-two'] = _SERIALIZER.query("query_two", query_two, 'int') + _params["query-two"] = _SERIALIZER.query("query_two", query_two, "int") # Construct headers if header_one is not None: - _headers['header-one'] = _SERIALIZER.header("header_one", header_one, 'str') + _headers["header-one"] = _SERIALIZER.header("header_one", header_one, "str") if header_two is not None: - _headers['header-two'] = _SERIALIZER.header("header_two", header_two, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["header-two"] = _SERIALIZER.header("header_two", header_two, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_post_shared_parameter_group_object_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, header_one: Optional[str] = None, query_one: int = 30, **kwargs: Any +) -> HttpRequest: """Post parameters with a shared parameter group object. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -246,35 +209,26 @@ def build_post_shared_parameter_group_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - header_one = kwargs.pop('header_one', _headers.pop('header-one', None)) # type: Optional[str] - query_one = kwargs.pop('query_one', _params.pop('query-one', 30)) # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/parameterGrouping/sharedParameterGroupObject" # Construct parameters if query_one is not None: - _params['query-one'] = _SERIALIZER.query("query_one", query_one, 'int') + _params["query-one"] = _SERIALIZER.query("query_one", query_one, "int") # Construct headers if header_one is not None: - _headers['header-one'] = _SERIALIZER.header("header_one", header_one, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["header-one"] = _SERIALIZER.header("header_one", header_one, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_group_with_constant_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, grouped_constant: str = "foo", grouped_parameter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Parameter group with a constant. Pass in 'foo' for groupedConstant and 'bar' for groupedParameter. @@ -295,23 +249,16 @@ def build_group_with_constant_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - grouped_constant = kwargs.pop('grouped_constant', _headers.pop('groupedConstant', "foo")) # type: str - grouped_parameter = kwargs.pop('grouped_parameter', _headers.pop('groupedParameter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/parameterGrouping/groupWithConstant" # Construct headers if grouped_constant is not None: - _headers['groupedConstant'] = _SERIALIZER.header("grouped_constant", grouped_constant, 'str') + _headers["groupedConstant"] = _SERIALIZER.header("grouped_constant", grouped_constant, "str") if grouped_parameter is not None: - _headers['groupedParameter'] = _SERIALIZER.header("grouped_parameter", grouped_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["groupedParameter"] = _SERIALIZER.header("grouped_parameter", grouped_parameter, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py deleted file mode 100644 index 0266f130105..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureParameterGroupingLowLevel/azureparametergroupinglowlevel/rest/parameter_grouping/_request_builders_py3.py +++ /dev/null @@ -1,319 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_post_required_request( - path: str, - *, - json: int, - custom_header: Optional[str] = None, - query: int = 30, - **kwargs: Any -) -> HttpRequest: - """Post a bunch of required parameters grouped. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param path: Path parameter. Required. - :type path: str - :keyword json: Required. - :paramtype json: int - :keyword custom_header: Default value is None. - :paramtype custom_header: str - :keyword query: Query parameter with default. Default value is 30. - :paramtype query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/parameterGrouping/postRequired/{path}" - path_format_arguments = { - "path": _SERIALIZER.url("path", path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - if query is not None: - _params['query'] = _SERIALIZER.query("query", query, 'int') - - # Construct headers - if custom_header is not None: - _headers['customHeader'] = _SERIALIZER.header("custom_header", custom_header, 'str') - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post_optional_request( - *, - custom_header: Optional[str] = None, - query: int = 30, - **kwargs: Any -) -> HttpRequest: - """Post a bunch of optional parameters grouped. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword custom_header: Default value is None. - :paramtype custom_header: str - :keyword query: Query parameter with default. Default value is 30. - :paramtype query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/parameterGrouping/postOptional" - - # Construct parameters - if query is not None: - _params['query'] = _SERIALIZER.query("query", query, 'int') - - # Construct headers - if custom_header is not None: - _headers['customHeader'] = _SERIALIZER.header("custom_header", custom_header, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_post_reserved_words_request( - *, - from_parameter: Optional[str] = None, - accept_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Post a grouped parameters with reserved words. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword from_parameter: 'from' is a reserved word. Pass in 'bob' to pass. Default value is - None. - :paramtype from_parameter: str - :keyword accept_parameter: 'accept' is a reserved word. Pass in 'yes' to pass. Default value is - None. - :paramtype accept_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/parameterGrouping/postReservedWords" - - # Construct parameters - if from_parameter is not None: - _params['from'] = _SERIALIZER.query("from_parameter", from_parameter, 'str') - if accept_parameter is not None: - _params['accept'] = _SERIALIZER.query("accept_parameter", accept_parameter, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - **kwargs - ) - - -def build_post_multi_param_groups_request( - *, - header_one: Optional[str] = None, - query_one: int = 30, - header_two: Optional[str] = None, - query_two: int = 30, - **kwargs: Any -) -> HttpRequest: - """Post parameters from multiple different parameter groups. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword header_one: Default value is None. - :paramtype header_one: str - :keyword query_one: Query parameter with default. Default value is 30. - :paramtype query_one: int - :keyword header_two: Default value is None. - :paramtype header_two: str - :keyword query_two: Query parameter with default. Default value is 30. - :paramtype query_two: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/parameterGrouping/postMultipleParameterGroups" - - # Construct parameters - if query_one is not None: - _params['query-one'] = _SERIALIZER.query("query_one", query_one, 'int') - if query_two is not None: - _params['query-two'] = _SERIALIZER.query("query_two", query_two, 'int') - - # Construct headers - if header_one is not None: - _headers['header-one'] = _SERIALIZER.header("header_one", header_one, 'str') - if header_two is not None: - _headers['header-two'] = _SERIALIZER.header("header_two", header_two, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_post_shared_parameter_group_object_request( - *, - header_one: Optional[str] = None, - query_one: int = 30, - **kwargs: Any -) -> HttpRequest: - """Post parameters with a shared parameter group object. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword header_one: Default value is None. - :paramtype header_one: str - :keyword query_one: Query parameter with default. Default value is 30. - :paramtype query_one: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/parameterGrouping/sharedParameterGroupObject" - - # Construct parameters - if query_one is not None: - _params['query-one'] = _SERIALIZER.query("query_one", query_one, 'int') - - # Construct headers - if header_one is not None: - _headers['header-one'] = _SERIALIZER.header("header_one", header_one, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_group_with_constant_request( - *, - grouped_constant: str = "foo", - grouped_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Parameter group with a constant. Pass in 'foo' for groupedConstant and 'bar' for - groupedParameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword grouped_constant: A grouped parameter that is a constant. Known values are "foo" and - None. Default value is "foo". - :paramtype grouped_constant: str - :keyword grouped_parameter: Optional parameter part of a parameter grouping. Default value is - None. - :paramtype grouped_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/parameterGrouping/groupWithConstant" - - # Construct headers - if grouped_constant is not None: - _headers['groupedConstant'] = _SERIALIZER.header("grouped_constant", grouped_constant, 'str') - if grouped_parameter is not None: - _headers['groupedParameter'] = _SERIALIZER.header("grouped_parameter", grouped_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_client.py index 77fc15e7544..87224f2fe9b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestReportServiceForAzure: # pylint: disable=client-accepts-api-versi """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestReportServiceForAzureConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/__init__.py index 47e8a3b88d4..27743cef8de 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_report_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_report_request # type: ignore +from ._request_builders import build_get_report_request __all__ = [ "build_get_report_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders.py index 68b8942bfcf..db8e813c2d9 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_report_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get test coverage report. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -39,23 +35,16 @@ def build_get_report_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - qualifier = kwargs.pop('qualifier', _params.pop('qualifier', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/report/azure" # Construct parameters if qualifier is not None: - _params['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') + _params["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 8cb5f01784b..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureReportLowLevel/azurereportlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_report_request( - *, - qualifier: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get test coverage report. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' - in for Python). The only effect is, that generators that run all tests several times, can - distinguish the generated reports. Default value is None. - :paramtype qualifier: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/report/azure" - - # Construct parameters - if qualifier is not None: - _params['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_client.py index cbe8b138d85..2ac41ef4473 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/_client.py @@ -45,7 +45,6 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestAzureSpecialParametersTestClientConfiguration( subscription_id=subscription_id, credential=credential, **kwargs ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/__init__.py index 2de384d5760..65abc045813 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_method_global_valid_request - from ._request_builders_py3 import build_get_method_global_not_provided_valid_request - from ._request_builders_py3 import build_get_path_global_valid_request - from ._request_builders_py3 import build_get_swagger_global_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_method_global_valid_request # type: ignore - from ._request_builders import build_get_method_global_not_provided_valid_request # type: ignore - from ._request_builders import build_get_path_global_valid_request # type: ignore - from ._request_builders import build_get_swagger_global_valid_request # type: ignore +from ._request_builders import build_get_method_global_valid_request +from ._request_builders import build_get_method_global_not_provided_valid_request +from ._request_builders import build_get_path_global_valid_request +from ._request_builders import build_get_swagger_global_valid_request __all__ = [ "build_get_method_global_valid_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders.py index 5937b042e5b..ef9c32371ed 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_method_global_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_method_global_valid_request(**kwargs: Any) -> HttpRequest: """GET method with api-version modeled in global settings. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,31 +31,22 @@ def build_get_method_global_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview" # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_method_global_not_provided_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_method_global_not_provided_valid_request(**kwargs: Any) -> HttpRequest: """GET method with api-version modeled in global settings. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -74,31 +61,22 @@ def build_get_method_global_not_provided_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview" # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_path_global_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_path_global_valid_request(**kwargs: Any) -> HttpRequest: """GET method with api-version modeled in global settings. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -113,31 +91,22 @@ def build_get_path_global_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview" # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_swagger_global_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_swagger_global_valid_request(**kwargs: Any) -> HttpRequest: """GET method with api-version modeled in global settings. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -152,22 +121,16 @@ def build_get_swagger_global_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview" # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders_py3.py deleted file mode 100644 index b12e608903f..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_default/_request_builders_py3.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_method_global_valid_request( - **kwargs: Any -) -> HttpRequest: - """GET method with api-version modeled in global settings. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/apiVersion/method/string/none/query/global/2015-07-01-preview" - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_method_global_not_provided_valid_request( - **kwargs: Any -) -> HttpRequest: - """GET method with api-version modeled in global settings. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/apiVersion/method/string/none/query/globalNotProvided/2015-07-01-preview" - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_path_global_valid_request( - **kwargs: Any -) -> HttpRequest: - """GET method with api-version modeled in global settings. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/apiVersion/path/string/none/query/global/2015-07-01-preview" - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_swagger_global_valid_request( - **kwargs: Any -) -> HttpRequest: - """GET method with api-version modeled in global settings. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/apiVersion/swagger/string/none/query/global/2015-07-01-preview" - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/__init__.py index 1b0edf68897..86fa8963847 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_method_local_valid_request - from ._request_builders_py3 import build_get_method_local_null_request - from ._request_builders_py3 import build_get_path_local_valid_request - from ._request_builders_py3 import build_get_swagger_local_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_method_local_valid_request # type: ignore - from ._request_builders import build_get_method_local_null_request # type: ignore - from ._request_builders import build_get_path_local_valid_request # type: ignore - from ._request_builders import build_get_swagger_local_valid_request # type: ignore +from ._request_builders import build_get_method_local_valid_request +from ._request_builders import build_get_method_local_null_request +from ._request_builders import build_get_path_local_valid_request +from ._request_builders import build_get_swagger_local_valid_request __all__ = [ "build_get_method_local_valid_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders.py index c431fdde7d3..2bfde64615b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_method_local_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_method_local_valid_request(**kwargs: Any) -> HttpRequest: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -38,31 +34,22 @@ def build_get_method_local_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2.0")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/apiVersion/method/string/none/query/local/2.0" # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_method_local_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_method_local_null_request(*, api_version: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get method with api-version modeled in the method. pass in api-version = null to succeed. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -80,32 +67,22 @@ def build_get_method_local_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/apiVersion/method/string/none/query/local/null" # Construct parameters if api_version is not None: - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_path_local_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_path_local_valid_request(**kwargs: Any) -> HttpRequest: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -123,31 +100,22 @@ def build_get_path_local_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2.0")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/apiVersion/path/string/none/query/local/2.0" # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_swagger_local_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_swagger_local_valid_request(**kwargs: Any) -> HttpRequest: """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -166,22 +134,16 @@ def build_get_swagger_local_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2.0")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/apiVersion/swagger/string/none/query/local/2.0" # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders_py3.py deleted file mode 100644 index 4b8e7025185..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/api_version_local/_request_builders_py3.py +++ /dev/null @@ -1,184 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_method_local_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword api_version: This should appear as a method parameter, use value '2.0'. Default value - is "2.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/apiVersion/method/string/none/query/local/2.0" - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_method_local_null_request( - *, - api_version: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get method with api-version modeled in the method. pass in api-version = null to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword api_version: This should appear as a method parameter, use value null, this should - result in no serialized parameter. Default value is None. - :paramtype api_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/apiVersion/method/string/none/query/local/null" - - # Construct parameters - if api_version is not None: - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_path_local_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword api_version: This should appear as a method parameter, use value '2.0'. Default value - is "2.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/apiVersion/path/string/none/query/local/2.0" - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_swagger_local_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get method with api-version modeled in the method. pass in api-version = '2.0' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword api_version: The api version, which appears in the query, the value is always '2.0'. - Default value is "2.0". Note that overriding this default value may result in unsupported - behavior. - :paramtype api_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2.0")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/apiVersion/swagger/string/none/query/local/2.0" - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/__init__.py index 9482c75db3a..656d7c21179 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_custom_named_request_id_request - from ._request_builders_py3 import build_custom_named_request_id_param_grouping_request - from ._request_builders_py3 import build_custom_named_request_id_head_request -except (SyntaxError, ImportError): - from ._request_builders import build_custom_named_request_id_request # type: ignore - from ._request_builders import build_custom_named_request_id_param_grouping_request # type: ignore - from ._request_builders import build_custom_named_request_id_head_request # type: ignore +from ._request_builders import build_custom_named_request_id_request +from ._request_builders import build_custom_named_request_id_param_grouping_request +from ._request_builders import build_custom_named_request_id_head_request __all__ = [ "build_custom_named_request_id_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders.py index d70dc2f5535..35fe7f84997 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_custom_named_request_id_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_custom_named_request_id_request(*, foo_client_request_id: str, **kwargs: Any) -> HttpRequest: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -36,28 +32,19 @@ def build_custom_named_request_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - foo_client_request_id = kwargs.pop('foo_client_request_id') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/customNamedRequestId" # Construct headers - _headers['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["foo-client-request-id"] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_custom_named_request_id_param_grouping_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_custom_named_request_id_param_grouping_request(*, foo_client_request_id: str, **kwargs: Any) -> HttpRequest: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, via a parameter group. @@ -74,28 +61,19 @@ def build_custom_named_request_id_param_grouping_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - foo_client_request_id = kwargs.pop('foo_client_request_id') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/customNamedRequestIdParamGrouping" # Construct headers - _headers['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["foo-client-request-id"] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_custom_named_request_id_head_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_custom_named_request_id_head_request(*, foo_client_request_id: str, **kwargs: Any) -> HttpRequest: """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -111,19 +89,13 @@ def build_custom_named_request_id_head_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - foo_client_request_id = kwargs.pop('foo_client_request_id') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/customNamedRequestIdHead" # Construct headers - _headers['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + _headers["foo-client-request-id"] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders_py3.py deleted file mode 100644 index 96e9b1c5c09..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/header/_request_builders_py3.py +++ /dev/null @@ -1,129 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_custom_named_request_id_request( - *, - foo_client_request_id: str, - **kwargs: Any -) -> HttpRequest: - """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword foo_client_request_id: The fooRequestId. Required. - :paramtype foo_client_request_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/customNamedRequestId" - - # Construct headers - _headers['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_custom_named_request_id_param_grouping_request( - *, - foo_client_request_id: str, - **kwargs: Any -) -> HttpRequest: - """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request, - via a parameter group. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword foo_client_request_id: The fooRequestId. Required. - :paramtype foo_client_request_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/customNamedRequestIdParamGrouping" - - # Construct headers - _headers['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_custom_named_request_id_head_request( - *, - foo_client_request_id: str, - **kwargs: Any -) -> HttpRequest: - """Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword foo_client_request_id: The fooRequestId. Required. - :paramtype foo_client_request_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/customNamedRequestIdHead" - - # Construct headers - _headers['foo-client-request-id'] = _SERIALIZER.header("foo_client_request_id", foo_client_request_id, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/__init__.py index ed7f4a99f12..e8fe5dde319 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_with_filter_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_with_filter_request # type: ignore +from ._request_builders import build_get_with_filter_request __all__ = [ "build_get_with_filter_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders.py index 48fa3e6b346..9de2fc82b22 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders.py @@ -15,12 +15,10 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_with_filter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, filter: Optional[str] = None, top: Optional[int] = None, orderby: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -42,29 +40,20 @@ def build_get_with_filter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - filter = kwargs.pop('filter', _params.pop('$filter', None)) # type: Optional[str] - top = kwargs.pop('top', _params.pop('$top', None)) # type: Optional[int] - orderby = kwargs.pop('orderby', _params.pop('$orderby', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/odata/filter" # Construct parameters if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params["$top"] = _SERIALIZER.query("top", top, "int") if orderby is not None: - _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') + _params["$orderby"] = _SERIALIZER.query("orderby", orderby, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders_py3.py deleted file mode 100644 index 796ef11fb7d..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/odata/_request_builders_py3.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_with_filter_request( - *, - filter: Optional[str] = None, - top: Optional[int] = None, - orderby: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Specify filter parameter with value '$filter=id gt 5 and name eq 'foo'&$orderby=id&$top=10'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword filter: The filter parameter with value '$filter=id gt 5 and name eq 'foo''. Default - value is None. - :paramtype filter: str - :keyword top: The top parameter with value 10. Default value is None. - :paramtype top: int - :keyword orderby: The orderby parameter with value id. Default value is None. - :paramtype orderby: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/odata/filter" - - # Construct parameters - if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') - if top is not None: - _params['$top'] = _SERIALIZER.query("top", top, 'int') - if orderby is not None: - _params['$orderby'] = _SERIALIZER.query("orderby", orderby, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/__init__.py index 75de623f002..e1f7ba1be74 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/__init__.py @@ -6,22 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_method_path_valid_request - from ._request_builders_py3 import build_get_path_valid_request - from ._request_builders_py3 import build_get_swagger_path_valid_request - from ._request_builders_py3 import build_get_method_query_valid_request - from ._request_builders_py3 import build_get_method_query_null_request - from ._request_builders_py3 import build_get_path_query_valid_request - from ._request_builders_py3 import build_get_swagger_query_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_method_path_valid_request # type: ignore - from ._request_builders import build_get_path_valid_request # type: ignore - from ._request_builders import build_get_swagger_path_valid_request # type: ignore - from ._request_builders import build_get_method_query_valid_request # type: ignore - from ._request_builders import build_get_method_query_null_request # type: ignore - from ._request_builders import build_get_path_query_valid_request # type: ignore - from ._request_builders import build_get_swagger_query_valid_request # type: ignore +from ._request_builders import build_get_method_path_valid_request +from ._request_builders import build_get_path_valid_request +from ._request_builders import build_get_swagger_path_valid_request +from ._request_builders import build_get_method_query_valid_request +from ._request_builders import build_get_method_query_null_request +from ._request_builders import build_get_path_query_valid_request +from ._request_builders import build_get_swagger_query_valid_request __all__ = [ "build_get_method_path_valid_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders.py index a0ff6bf32ca..7eded9a2315 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders.py @@ -16,13 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_method_path_valid_request( - unencoded_path_param, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_method_path_valid_request(unencoded_path_param: str, **kwargs: Any) -> HttpRequest: """Get method with unencoded path parameter with value 'path1/path2/path3'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -38,32 +33,23 @@ def build_get_method_path_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}" path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_path_valid_request( - unencoded_path_param, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_path_valid_request(unencoded_path_param: str, **kwargs: Any) -> HttpRequest: """Get method with unencoded path parameter with value 'path1/path2/path3'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -79,31 +65,23 @@ def build_get_path_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}" path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_swagger_path_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_swagger_path_valid_request(**kwargs: Any) -> HttpRequest: """Get method with unencoded path parameter with value 'path1/path2/path3'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -121,32 +99,24 @@ def build_get_swagger_path_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - unencoded_path_param = kwargs.pop('unencoded_path_param', "path1/path2/path3") # type: str - accept = _headers.pop('Accept', "application/json") + unencoded_path_param = kwargs.pop("unencoded_path_param", "path1/path2/path3") # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}" path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), + "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_method_query_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_method_query_valid_request(*, q1: str, **kwargs: Any) -> HttpRequest: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -163,31 +133,21 @@ def build_get_method_query_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - q1 = kwargs.pop('q1') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/skipUrlEncoding/method/query/valid" # Construct parameters - _params['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) + _params["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_method_query_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_method_query_null_request(*, q1: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get method with unencoded query parameter with value null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -204,32 +164,22 @@ def build_get_method_query_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - q1 = kwargs.pop('q1', _params.pop('q1', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/skipUrlEncoding/method/query/null" # Construct parameters if q1 is not None: - _params['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) + _params["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_path_query_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_path_query_valid_request(*, q1: str, **kwargs: Any) -> HttpRequest: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -246,31 +196,21 @@ def build_get_path_query_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - q1 = kwargs.pop('q1') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/skipUrlEncoding/path/query/valid" # Construct parameters - _params['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) + _params["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_swagger_query_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_swagger_query_valid_request(**kwargs: Any) -> HttpRequest: """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -289,22 +229,16 @@ def build_get_swagger_query_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - q1 = kwargs.pop('q1', _params.pop('q1', "value1&q2=value2&q3=value3")) # type: str - accept = _headers.pop('Accept', "application/json") + q1 = kwargs.pop("q1", _params.pop("q1", "value1&q2=value2&q3=value3")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/skipUrlEncoding/swagger/query/valid" # Construct parameters - _params['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) + _params["q1"] = _SERIALIZER.query("q1", q1, "str", skip_quote=True) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders_py3.py deleted file mode 100644 index fdcdd941888..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/skip_url_encoding/_request_builders_py3.py +++ /dev/null @@ -1,306 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_method_path_valid_request( - unencoded_path_param: str, - **kwargs: Any -) -> HttpRequest: - """Get method with unencoded path parameter with value 'path1/path2/path3'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3'. Required. - :type unencoded_path_param: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/skipUrlEncoding/method/path/valid/{unencodedPathParam}" - path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_path_valid_request( - unencoded_path_param: str, - **kwargs: Any -) -> HttpRequest: - """Get method with unencoded path parameter with value 'path1/path2/path3'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param unencoded_path_param: Unencoded path parameter with value 'path1/path2/path3'. Required. - :type unencoded_path_param: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/skipUrlEncoding/path/path/valid/{unencodedPathParam}" - path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_swagger_path_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get method with unencoded path parameter with value 'path1/path2/path3'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword unencoded_path_param: An unencoded path parameter with value 'path1/path2/path3'. - Default value is "path1/path2/path3". Note that overriding this default value may result in - unsupported behavior. - :paramtype unencoded_path_param: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - unencoded_path_param = kwargs.pop('unencoded_path_param', "path1/path2/path3") # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/skipUrlEncoding/swagger/path/valid/{unencodedPathParam}" - path_format_arguments = { - "unencodedPathParam": _SERIALIZER.url("unencoded_path_param", unencoded_path_param, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_method_query_valid_request( - *, - q1: str, - **kwargs: Any -) -> HttpRequest: - """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3'. Required. - :paramtype q1: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/skipUrlEncoding/method/query/valid" - - # Construct parameters - _params['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_method_query_null_request( - *, - q1: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get method with unencoded query parameter with value null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword q1: Unencoded query parameter with value null. Default value is None. - :paramtype q1: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/skipUrlEncoding/method/query/null" - - # Construct parameters - if q1 is not None: - _params['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_path_query_valid_request( - *, - q1: str, - **kwargs: Any -) -> HttpRequest: - """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword q1: Unencoded query parameter with value 'value1&q2=value2&q3=value3'. Required. - :paramtype q1: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/skipUrlEncoding/path/query/valid" - - # Construct parameters - _params['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_swagger_query_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get method with unencoded query parameter with value 'value1&q2=value2&q3=value3'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword q1: An unencoded query parameter with value 'value1&q2=value2&q3=value3'. Default - value is "value1&q2=value2&q3=value3". Note that overriding this default value may result in - unsupported behavior. - :paramtype q1: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - q1 = kwargs.pop('q1', _params.pop('q1', "value1&q2=value2&q3=value3")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/skipUrlEncoding/swagger/query/valid" - - # Construct parameters - _params['q1'] = _SERIALIZER.query("q1", q1, 'str', skip_quote=True) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/__init__.py index 037aec6cb67..5b837125d8d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/__init__.py @@ -6,18 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_post_method_global_valid_request - from ._request_builders_py3 import build_post_method_global_null_request - from ._request_builders_py3 import build_post_method_global_not_provided_valid_request - from ._request_builders_py3 import build_post_path_global_valid_request - from ._request_builders_py3 import build_post_swagger_global_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_post_method_global_valid_request # type: ignore - from ._request_builders import build_post_method_global_null_request # type: ignore - from ._request_builders import build_post_method_global_not_provided_valid_request # type: ignore - from ._request_builders import build_post_path_global_valid_request # type: ignore - from ._request_builders import build_post_swagger_global_valid_request # type: ignore +from ._request_builders import build_post_method_global_valid_request +from ._request_builders import build_post_method_global_null_request +from ._request_builders import build_post_method_global_not_provided_valid_request +from ._request_builders import build_post_path_global_valid_request +from ._request_builders import build_post_swagger_global_valid_request __all__ = [ "build_post_method_global_valid_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders.py index 0300b1c1097..096fe065d4b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders.py @@ -16,13 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_post_method_global_valid_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_method_global_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -40,32 +35,23 @@ def build_post_method_global_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_method_global_null_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_method_global_null_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to null, and client-side validation should prevent you from making this call. @@ -83,32 +69,23 @@ def build_post_method_global_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_method_global_not_provided_valid_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_method_global_not_provided_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -127,37 +104,29 @@ def build_post_method_global_not_provided_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-07-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}" + _url = ( + "/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_post_path_global_valid_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + +def build_post_path_global_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -175,32 +144,23 @@ def build_post_path_global_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_swagger_global_valid_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_swagger_global_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed. @@ -218,22 +178,17 @@ def build_post_swagger_global_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders_py3.py deleted file mode 100644 index ce75d9fcad7..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_credentials/_request_builders_py3.py +++ /dev/null @@ -1,234 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_post_method_global_valid_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to - '1234-5678-9012-3456' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: The subscription id, which appears in the path, always modeled in - credentials. The value is always '1234-5678-9012-3456'. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/method/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_method_global_null_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to - null, and client-side validation should prevent you from making this call. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: The subscription id, which appears in the path, always modeled in - credentials. The value is always '1234-5678-9012-3456'. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/method/string/none/path/global/null/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_method_global_not_provided_valid_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to - '1234-5678-9012-3456' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: The subscription id, which appears in the path, always modeled in - credentials. The value is always '1234-5678-9012-3456'. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-07-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/method/string/none/path/globalNotProvided/1234-5678-9012-3456/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_post_path_global_valid_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to - '1234-5678-9012-3456' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: The subscription id, which appears in the path, always modeled in - credentials. The value is always '1234-5678-9012-3456'. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/path/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_swagger_global_valid_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to - '1234-5678-9012-3456' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: The subscription id, which appears in the path, always modeled in - credentials. The value is always '1234-5678-9012-3456'. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/swagger/string/none/path/global/1234-5678-9012-3456/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/__init__.py index f9e02296e01..5ab9b3bbdc1 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_post_method_local_valid_request - from ._request_builders_py3 import build_post_method_local_null_request - from ._request_builders_py3 import build_post_path_local_valid_request - from ._request_builders_py3 import build_post_swagger_local_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_post_method_local_valid_request # type: ignore - from ._request_builders import build_post_method_local_null_request # type: ignore - from ._request_builders import build_post_path_local_valid_request # type: ignore - from ._request_builders import build_post_swagger_local_valid_request # type: ignore +from ._request_builders import build_post_method_local_valid_request +from ._request_builders import build_post_method_local_null_request +from ._request_builders import build_post_path_local_valid_request +from ._request_builders import build_post_swagger_local_valid_request __all__ = [ "build_post_method_local_valid_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders.py index 7e4d52801ef..b74962412b8 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders.py @@ -16,13 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_post_method_local_valid_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_method_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -40,32 +35,23 @@ def build_post_method_local_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_method_local_null_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_method_local_null_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in the method. pass in subscription id = null, client-side validation should prevent you from making this call. @@ -83,32 +69,23 @@ def build_post_method_local_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_path_local_valid_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_path_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -126,32 +103,23 @@ def build_post_path_local_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_swagger_local_valid_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_swagger_local_valid_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """POST method with subscriptionId modeled in the method. pass in subscription id = '1234-5678-9012-3456' to succeed. @@ -169,22 +137,17 @@ def build_post_swagger_local_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders_py3.py deleted file mode 100644 index f25ec363e25..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/subscription_in_method/_request_builders_py3.py +++ /dev/null @@ -1,186 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_post_method_local_valid_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in the method. pass in subscription id = - '1234-5678-9012-3456' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: This should appear as a method parameter, use value - '1234-5678-9012-3456'. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/method/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_method_local_null_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in the method. pass in subscription id = null, - client-side validation should prevent you from making this call. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: This should appear as a method parameter, use value null, client-side - validation should prvenet the call. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/method/string/none/path/local/null/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_path_local_valid_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in the method. pass in subscription id = - '1234-5678-9012-3456' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: Should appear as a method parameter -use value '1234-5678-9012-3456'. - Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/path/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_swagger_local_valid_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """POST method with subscriptionId modeled in the method. pass in subscription id = - '1234-5678-9012-3456' to succeed. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: The subscriptionId, which appears in the path, the value is always - '1234-5678-9012-3456'. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/subscriptionId/swagger/string/none/path/local/1234-5678-9012-3456/{subscriptionId}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/__init__.py index d91016b544c..8ba2b17ba2d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_request - from ._request_builders_py3 import build_param_get_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_request # type: ignore - from ._request_builders import build_param_get_request # type: ignore +from ._request_builders import build_get_request +from ._request_builders import build_param_get_request __all__ = [ "build_get_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders.py index 62700566f28..bd34cfe853a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_request(**kwargs: Any) -> HttpRequest: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -36,17 +32,10 @@ def build_get_request( # Construct URL _url = "/azurespecials/overwrite/x-ms-client-request-id/method/" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_param_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_get_request(*, x_ms_client_request_id: str, **kwargs: Any) -> HttpRequest: """Get method that overwrites x-ms-client-request header with value 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. @@ -64,19 +53,13 @@ def build_param_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - x_ms_client_request_id = kwargs.pop('x_ms_client_request_id') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/azurespecials/overwrite/x-ms-client-request-id/via-param/method/" # Construct headers - _headers['x-ms-client-request-id'] = _SERIALIZER.header("x_ms_client_request_id", x_ms_client_request_id, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["x-ms-client-request-id"] = _SERIALIZER.header("x_ms_client_request_id", x_ms_client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders_py3.py deleted file mode 100644 index 0457717a8e1..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/AzureSpecialsLowLevel/azurespecialpropertieslowlevel/rest/xms_client_request_id/_request_builders_py3.py +++ /dev/null @@ -1,81 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_request( - **kwargs: Any -) -> HttpRequest: - """Get method that overwrites x-ms-client-request header with value - 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/azurespecials/overwrite/x-ms-client-request-id/method/" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_param_get_request( - *, - x_ms_client_request_id: str, - **kwargs: Any -) -> HttpRequest: - """Get method that overwrites x-ms-client-request header with value - 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword x_ms_client_request_id: This should appear as a method parameter, use value - '9C4D50EE-2D56-4CD3-8152-34347DC9F2B0'. Required. - :paramtype x_ms_client_request_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/azurespecials/overwrite/x-ms-client-request-id/via-param/method/" - - # Construct headers - _headers['x-ms-client-request-id'] = _SERIALIZER.header("x_ms_client_request_id", x_ms_client_request_id, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py index 5daa0aa077d..b03437179b1 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_empty_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_empty_request # type: ignore +from ._request_builders import build_get_empty_request __all__ = [ "build_get_empty_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py index 9ec0f524b4a..feca717c807 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get a 200 to test a valid base uri. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,17 +30,12 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customuri" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py deleted file mode 100644 index 26eff9ce07a..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get a 200 to test a valid base uri. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customuri" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/__init__.py index 2bf67c01227..fcad56b77b7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_pages_partial_url_request - from ._request_builders_py3 import build_get_pages_partial_url_operation_request - from ._request_builders_py3 import build_get_pages_partial_url_operation_next_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_pages_partial_url_request # type: ignore - from ._request_builders import build_get_pages_partial_url_operation_request # type: ignore - from ._request_builders import build_get_pages_partial_url_operation_next_request # type: ignore +from ._request_builders import build_get_pages_partial_url_request +from ._request_builders import build_get_pages_partial_url_operation_request +from ._request_builders import build_get_pages_partial_url_operation_next_request __all__ = [ "build_get_pages_partial_url_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders.py index 7727ae8646d..9615b2833d0 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_pages_partial_url_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_pages_partial_url_request(**kwargs: Any) -> HttpRequest: """A paging operation that combines custom url, paging and partial URL and expect to concat after host. @@ -36,26 +32,18 @@ def build_get_pages_partial_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/customurl/partialnextlink" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_pages_partial_url_operation_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_pages_partial_url_operation_request(**kwargs: Any) -> HttpRequest: """A paging operation that combines custom url, paging and partial URL with next operation. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -69,27 +57,18 @@ def build_get_pages_partial_url_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/customurl/partialnextlinkop" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_pages_partial_url_operation_next_request( - next_link, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_pages_partial_url_operation_next_request(next_link: str, **kwargs: Any) -> HttpRequest: """A paging operation that combines custom url, paging and partial URL See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -105,22 +84,17 @@ def build_get_pages_partial_url_operation_next_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/customurl/{nextLink}" path_format_arguments = { - "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), + "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders_py3.py deleted file mode 100644 index a9d7c73b8e9..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/CustomUrlPagingLowLevel/custombaseurlpaginglowlevel/rest/paging/_request_builders_py3.py +++ /dev/null @@ -1,123 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_pages_partial_url_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that combines custom url, paging and partial URL and expect to concat after - host. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/customurl/partialnextlink" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_pages_partial_url_operation_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that combines custom url, paging and partial URL with next operation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/customurl/partialnextlinkop" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_pages_partial_url_operation_next_request( - next_link: str, - **kwargs: Any -) -> HttpRequest: - """A paging operation that combines custom url, paging and partial URL - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param next_link: Next link for the list operation. Required. - :type next_link: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/customurl/{nextLink}" - path_format_arguments = { - "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_client.py index 074bf6bfe4d..1e8bbe2854e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/_client.py @@ -34,7 +34,6 @@ class AutoRestHeadExceptionTestService: # pylint: disable=client-accepts-api-ve def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestHeadExceptionTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/__init__.py index 5581e44ff36..a311ff2bf79 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head200_request - from ._request_builders_py3 import build_head204_request - from ._request_builders_py3 import build_head404_request -except (SyntaxError, ImportError): - from ._request_builders import build_head200_request # type: ignore - from ._request_builders import build_head204_request # type: ignore - from ._request_builders import build_head404_request # type: ignore +from ._request_builders import build_head200_request +from ._request_builders import build_head204_request +from ._request_builders import build_head404_request __all__ = [ "build_head200_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders.py index 28d1ab2cc33..efe990563d3 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders.py @@ -14,12 +14,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head200_request(**kwargs: Any) -> HttpRequest: """Return 200 status code if successful. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,17 +30,10 @@ def build_head200_request( # Construct URL _url = "/http/success/200" - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head204_request(**kwargs: Any) -> HttpRequest: """Return 204 status code if successful. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -59,17 +48,10 @@ def build_head204_request( # Construct URL _url = "/http/success/204" - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head404_request(**kwargs: Any) -> HttpRequest: """Return 404 status code if successful. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -84,8 +66,4 @@ def build_head404_request( # Construct URL _url = "/http/success/404" - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders_py3.py deleted file mode 100644 index 0f6daf14d74..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadExceptionsLowLevel/headexceptionslowlevel/rest/head_exception/_request_builders_py3.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head200_request( - **kwargs: Any -) -> HttpRequest: - """Return 200 status code if successful. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/success/200" - - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) - - -def build_head204_request( - **kwargs: Any -) -> HttpRequest: - """Return 204 status code if successful. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/success/204" - - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) - - -def build_head404_request( - **kwargs: Any -) -> HttpRequest: - """Return 404 status code if successful. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/success/404" - - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_client.py index 50d23049e33..03be12b794b 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/_client.py @@ -34,7 +34,6 @@ class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-key def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/__init__.py index 5581e44ff36..a311ff2bf79 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head200_request - from ._request_builders_py3 import build_head204_request - from ._request_builders_py3 import build_head404_request -except (SyntaxError, ImportError): - from ._request_builders import build_head200_request # type: ignore - from ._request_builders import build_head204_request # type: ignore - from ._request_builders import build_head404_request # type: ignore +from ._request_builders import build_head200_request +from ._request_builders import build_head204_request +from ._request_builders import build_head404_request __all__ = [ "build_head200_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders.py index 28d1ab2cc33..efe990563d3 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders.py @@ -14,12 +14,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head200_request(**kwargs: Any) -> HttpRequest: """Return 200 status code if successful. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,17 +30,10 @@ def build_head200_request( # Construct URL _url = "/http/success/200" - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head204_request(**kwargs: Any) -> HttpRequest: """Return 204 status code if successful. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -59,17 +48,10 @@ def build_head204_request( # Construct URL _url = "/http/success/204" - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) -def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head404_request(**kwargs: Any) -> HttpRequest: """Return 404 status code if successful. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -84,8 +66,4 @@ def build_head404_request( # Construct URL _url = "/http/success/404" - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders_py3.py deleted file mode 100644 index 0f6daf14d74..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/HeadLowLevel/headlowlevel/rest/http_success/_request_builders_py3.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head200_request( - **kwargs: Any -) -> HttpRequest: - """Return 200 status code if successful. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/success/200" - - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) - - -def build_head204_request( - **kwargs: Any -) -> HttpRequest: - """Return 204 status code if successful. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/success/204" - - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) - - -def build_head404_request( - **kwargs: Any -) -> HttpRequest: - """Return 404 status code if successful. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/success/404" - - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_client.py index f7ea6a54fb4..c2736989588 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/_client.py @@ -34,7 +34,6 @@ class AutoRestLongRunningOperationTestService: # pylint: disable=client-accepts def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestLongRunningOperationTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/__init__.py index b9d80b78ba2..af267aa118e 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put_async_retry_succeeded_request - from ._request_builders_py3 import build_put201_creating_succeeded200_request - from ._request_builders_py3 import build_post202_retry200_request - from ._request_builders_py3 import build_post_async_retry_succeeded_request -except (SyntaxError, ImportError): - from ._request_builders import build_put_async_retry_succeeded_request # type: ignore - from ._request_builders import build_put201_creating_succeeded200_request # type: ignore - from ._request_builders import build_post202_retry200_request # type: ignore - from ._request_builders import build_post_async_retry_succeeded_request # type: ignore +from ._request_builders import build_put_async_retry_succeeded_request +from ._request_builders import build_put201_creating_succeeded200_request +from ._request_builders import build_post202_retry200_request +from ._request_builders import build_post_async_retry_succeeded_request __all__ = [ "build_put_async_retry_succeeded_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py index c19cf70badf..287b51950a9 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders.py @@ -22,13 +22,11 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload def build_put_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -71,9 +69,8 @@ def build_put_async_retry_succeeded_request( @overload def build_put_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -94,10 +91,7 @@ def build_put_async_retry_succeeded_request( """ -def build_put_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -119,30 +113,24 @@ def build_put_async_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/customheader/putasync/retry/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -185,9 +173,8 @@ def build_put201_creating_succeeded200_request( @overload def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -208,10 +195,7 @@ def build_put201_creating_succeeded200_request( """ -def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put201_creating_succeeded200_request(**kwargs: Any) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -233,30 +217,24 @@ def build_put201_creating_succeeded200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/customheader/put/201/creating/succeeded/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -298,9 +276,8 @@ def build_post202_retry200_request( @overload def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -320,10 +297,7 @@ def build_post202_retry200_request( """ -def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_retry200_request(**kwargs: Any) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -344,30 +318,24 @@ def build_post202_retry200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/customheader/post/202/retry/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -410,9 +378,8 @@ def build_post_async_retry_succeeded_request( @overload def build_post_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -433,10 +400,7 @@ def build_post_async_retry_succeeded_request( """ -def build_post_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the @@ -458,20 +422,15 @@ def build_post_async_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/customheader/postasync/retry/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py deleted file mode 100644 index 9156b270648..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lr_os_custom_header/_request_builders_py3.py +++ /dev/null @@ -1,489 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_put_async_retry_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running put request, service returns a 200 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_retry_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running put request, service returns a 200 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running put request, service returns a 200 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/customheader/putasync/retry/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put201_creating_succeeded200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running put request, service returns a 201 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll - returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put201_creating_succeeded200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running put request, service returns a 201 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll - returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put201_creating_succeeded200_request( - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running put request, service returns a 201 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll - returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/customheader/put/201/creating/succeeded/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post202_retry200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running post request, service returns a 202 to the initial request, with - 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post202_retry200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running post request, service returns a 202 to the initial request, with - 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post202_retry200_request( - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running post request, service returns a 202 to the initial request, with - 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/customheader/post/202/retry/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_retry_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running post request, service returns a 202 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_retry_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running post request, service returns a 202 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for - all requests. Long running post request, service returns a 202 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/customheader/postasync/retry/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/__init__.py index 5adea5a6e47..96da443d477 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/__init__.py @@ -6,22 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put201_creating_succeeded200_request - from ._request_builders_py3 import build_put_async_relative_retry_succeeded_request - from ._request_builders_py3 import build_delete_provisioning202_accepted200_succeeded_request - from ._request_builders_py3 import build_delete202_retry200_request - from ._request_builders_py3 import build_delete_async_relative_retry_succeeded_request - from ._request_builders_py3 import build_post202_retry200_request - from ._request_builders_py3 import build_post_async_relative_retry_succeeded_request -except (SyntaxError, ImportError): - from ._request_builders import build_put201_creating_succeeded200_request # type: ignore - from ._request_builders import build_put_async_relative_retry_succeeded_request # type: ignore - from ._request_builders import build_delete_provisioning202_accepted200_succeeded_request # type: ignore - from ._request_builders import build_delete202_retry200_request # type: ignore - from ._request_builders import build_delete_async_relative_retry_succeeded_request # type: ignore - from ._request_builders import build_post202_retry200_request # type: ignore - from ._request_builders import build_post_async_relative_retry_succeeded_request # type: ignore +from ._request_builders import build_put201_creating_succeeded200_request +from ._request_builders import build_put_async_relative_retry_succeeded_request +from ._request_builders import build_delete_provisioning202_accepted200_succeeded_request +from ._request_builders import build_delete202_retry200_request +from ._request_builders import build_delete_async_relative_retry_succeeded_request +from ._request_builders import build_post202_retry200_request +from ._request_builders import build_post_async_relative_retry_succeeded_request __all__ = [ "build_put201_creating_succeeded200_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py index 503f4e17839..18fbdd61615 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders.py @@ -22,13 +22,11 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -70,9 +68,8 @@ def build_put201_creating_succeeded200_request( @overload def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -92,10 +89,7 @@ def build_put201_creating_succeeded200_request( """ -def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put201_creating_succeeded200_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -116,30 +110,24 @@ def build_put201_creating_succeeded200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/retryerror/put/201/creating/succeeded/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_relative_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -181,9 +169,8 @@ def build_put_async_relative_retry_succeeded_request( @overload def build_put_async_relative_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -203,10 +190,7 @@ def build_put_async_relative_retry_succeeded_request( """ -def build_put_async_relative_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_relative_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -227,29 +211,21 @@ def build_put_async_relative_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/retryerror/putasync/retry/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_delete_provisioning202_accepted200_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_provisioning202_accepted200_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -265,26 +241,18 @@ def build_delete_provisioning202_accepted200_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete202_retry200_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -299,26 +267,18 @@ def build_delete202_retry200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/retryerror/delete/202/retry/200" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_relative_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_relative_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -333,27 +293,21 @@ def build_delete_async_relative_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/retryerror/deleteasync/retry/succeeded" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) @overload def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -394,9 +348,8 @@ def build_post202_retry200_request( @overload def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -415,10 +368,7 @@ def build_post202_retry200_request( """ -def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_retry200_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -438,30 +388,24 @@ def build_post202_retry200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/retryerror/post/202/retry/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_relative_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -503,9 +447,8 @@ def build_post_async_relative_retry_succeeded_request( @overload def build_post_async_relative_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -525,10 +468,7 @@ def build_post_async_relative_retry_succeeded_request( """ -def build_post_async_relative_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_relative_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -549,20 +489,15 @@ def build_post_async_relative_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/retryerror/postasync/retry/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py deleted file mode 100644 index eeea6a83ee7..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lro_retrys/_request_builders_py3.py +++ /dev/null @@ -1,577 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_put201_creating_succeeded200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 500, then a 201 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll - returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put201_creating_succeeded200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 500, then a 201 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll - returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put201_creating_succeeded200_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 500, then a 201 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll - returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/retryerror/put/201/creating/succeeded/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_relative_retry_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 500, then a 200 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_relative_retry_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 500, then a 200 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_relative_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 500, then a 200 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/retryerror/putasync/retry/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_provisioning202_accepted200_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 500, then a 202 to the initial request, with an - entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll - returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/retryerror/delete/provisioning/202/accepted/200/succeeded" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete202_retry200_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 500, then a 202 to the initial request. Polls - return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/retryerror/delete/202/retry/200" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_relative_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the - endpoint indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/retryerror/deleteasync/retry/succeeded" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post202_retry200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 500, then a 202 to the initial request, with - 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post202_retry200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 500, then a 202 to the initial request, with - 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post202_retry200_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 500, then a 202 to the initial request, with - 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/retryerror/post/202/retry/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_relative_retry_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 500, then a 202 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_relative_retry_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 500, then a 202 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_relative_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 500, then a 202 to the initial request, with an - entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the - Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/retryerror/postasync/retry/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/__init__.py index 28fcc79d717..d9f9b8a40c8 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/__init__.py @@ -6,96 +6,50 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put200_succeeded_request - from ._request_builders_py3 import build_patch200_succeeded_ignore_headers_request - from ._request_builders_py3 import build_patch201_retry_with_async_header_request - from ._request_builders_py3 import build_patch202_retry_with_async_and_location_header_request - from ._request_builders_py3 import build_put201_succeeded_request - from ._request_builders_py3 import build_post202_list_request - from ._request_builders_py3 import build_put200_succeeded_no_state_request - from ._request_builders_py3 import build_put202_retry200_request - from ._request_builders_py3 import build_put201_creating_succeeded200_request - from ._request_builders_py3 import build_put200_updating_succeeded204_request - from ._request_builders_py3 import build_put201_creating_failed200_request - from ._request_builders_py3 import build_put200_acceptedcanceled200_request - from ._request_builders_py3 import build_put_no_header_in_retry_request - from ._request_builders_py3 import build_put_async_retry_succeeded_request - from ._request_builders_py3 import build_put_async_no_retry_succeeded_request - from ._request_builders_py3 import build_put_async_retry_failed_request - from ._request_builders_py3 import build_put_async_no_retrycanceled_request - from ._request_builders_py3 import build_put_async_no_header_in_retry_request - from ._request_builders_py3 import build_put_non_resource_request - from ._request_builders_py3 import build_put_async_non_resource_request - from ._request_builders_py3 import build_put_sub_resource_request - from ._request_builders_py3 import build_put_async_sub_resource_request - from ._request_builders_py3 import build_delete_provisioning202_accepted200_succeeded_request - from ._request_builders_py3 import build_delete_provisioning202_deleting_failed200_request - from ._request_builders_py3 import build_delete_provisioning202_deletingcanceled200_request - from ._request_builders_py3 import build_delete204_succeeded_request - from ._request_builders_py3 import build_delete202_retry200_request - from ._request_builders_py3 import build_delete202_no_retry204_request - from ._request_builders_py3 import build_delete_no_header_in_retry_request - from ._request_builders_py3 import build_delete_async_no_header_in_retry_request - from ._request_builders_py3 import build_delete_async_retry_succeeded_request - from ._request_builders_py3 import build_delete_async_no_retry_succeeded_request - from ._request_builders_py3 import build_delete_async_retry_failed_request - from ._request_builders_py3 import build_delete_async_retrycanceled_request - from ._request_builders_py3 import build_post200_with_payload_request - from ._request_builders_py3 import build_post202_retry200_request - from ._request_builders_py3 import build_post202_no_retry204_request - from ._request_builders_py3 import build_post_double_headers_final_location_get_request - from ._request_builders_py3 import build_post_double_headers_final_azure_header_get_request - from ._request_builders_py3 import build_post_double_headers_final_azure_header_get_default_request - from ._request_builders_py3 import build_post_async_retry_succeeded_request - from ._request_builders_py3 import build_post_async_no_retry_succeeded_request - from ._request_builders_py3 import build_post_async_retry_failed_request - from ._request_builders_py3 import build_post_async_retrycanceled_request -except (SyntaxError, ImportError): - from ._request_builders import build_put200_succeeded_request # type: ignore - from ._request_builders import build_patch200_succeeded_ignore_headers_request # type: ignore - from ._request_builders import build_patch201_retry_with_async_header_request # type: ignore - from ._request_builders import build_patch202_retry_with_async_and_location_header_request # type: ignore - from ._request_builders import build_put201_succeeded_request # type: ignore - from ._request_builders import build_post202_list_request # type: ignore - from ._request_builders import build_put200_succeeded_no_state_request # type: ignore - from ._request_builders import build_put202_retry200_request # type: ignore - from ._request_builders import build_put201_creating_succeeded200_request # type: ignore - from ._request_builders import build_put200_updating_succeeded204_request # type: ignore - from ._request_builders import build_put201_creating_failed200_request # type: ignore - from ._request_builders import build_put200_acceptedcanceled200_request # type: ignore - from ._request_builders import build_put_no_header_in_retry_request # type: ignore - from ._request_builders import build_put_async_retry_succeeded_request # type: ignore - from ._request_builders import build_put_async_no_retry_succeeded_request # type: ignore - from ._request_builders import build_put_async_retry_failed_request # type: ignore - from ._request_builders import build_put_async_no_retrycanceled_request # type: ignore - from ._request_builders import build_put_async_no_header_in_retry_request # type: ignore - from ._request_builders import build_put_non_resource_request # type: ignore - from ._request_builders import build_put_async_non_resource_request # type: ignore - from ._request_builders import build_put_sub_resource_request # type: ignore - from ._request_builders import build_put_async_sub_resource_request # type: ignore - from ._request_builders import build_delete_provisioning202_accepted200_succeeded_request # type: ignore - from ._request_builders import build_delete_provisioning202_deleting_failed200_request # type: ignore - from ._request_builders import build_delete_provisioning202_deletingcanceled200_request # type: ignore - from ._request_builders import build_delete204_succeeded_request # type: ignore - from ._request_builders import build_delete202_retry200_request # type: ignore - from ._request_builders import build_delete202_no_retry204_request # type: ignore - from ._request_builders import build_delete_no_header_in_retry_request # type: ignore - from ._request_builders import build_delete_async_no_header_in_retry_request # type: ignore - from ._request_builders import build_delete_async_retry_succeeded_request # type: ignore - from ._request_builders import build_delete_async_no_retry_succeeded_request # type: ignore - from ._request_builders import build_delete_async_retry_failed_request # type: ignore - from ._request_builders import build_delete_async_retrycanceled_request # type: ignore - from ._request_builders import build_post200_with_payload_request # type: ignore - from ._request_builders import build_post202_retry200_request # type: ignore - from ._request_builders import build_post202_no_retry204_request # type: ignore - from ._request_builders import build_post_double_headers_final_location_get_request # type: ignore - from ._request_builders import build_post_double_headers_final_azure_header_get_request # type: ignore - from ._request_builders import build_post_double_headers_final_azure_header_get_default_request # type: ignore - from ._request_builders import build_post_async_retry_succeeded_request # type: ignore - from ._request_builders import build_post_async_no_retry_succeeded_request # type: ignore - from ._request_builders import build_post_async_retry_failed_request # type: ignore - from ._request_builders import build_post_async_retrycanceled_request # type: ignore +from ._request_builders import build_put200_succeeded_request +from ._request_builders import build_patch200_succeeded_ignore_headers_request +from ._request_builders import build_patch201_retry_with_async_header_request +from ._request_builders import build_patch202_retry_with_async_and_location_header_request +from ._request_builders import build_put201_succeeded_request +from ._request_builders import build_post202_list_request +from ._request_builders import build_put200_succeeded_no_state_request +from ._request_builders import build_put202_retry200_request +from ._request_builders import build_put201_creating_succeeded200_request +from ._request_builders import build_put200_updating_succeeded204_request +from ._request_builders import build_put201_creating_failed200_request +from ._request_builders import build_put200_acceptedcanceled200_request +from ._request_builders import build_put_no_header_in_retry_request +from ._request_builders import build_put_async_retry_succeeded_request +from ._request_builders import build_put_async_no_retry_succeeded_request +from ._request_builders import build_put_async_retry_failed_request +from ._request_builders import build_put_async_no_retrycanceled_request +from ._request_builders import build_put_async_no_header_in_retry_request +from ._request_builders import build_put_non_resource_request +from ._request_builders import build_put_async_non_resource_request +from ._request_builders import build_put_sub_resource_request +from ._request_builders import build_put_async_sub_resource_request +from ._request_builders import build_delete_provisioning202_accepted200_succeeded_request +from ._request_builders import build_delete_provisioning202_deleting_failed200_request +from ._request_builders import build_delete_provisioning202_deletingcanceled200_request +from ._request_builders import build_delete204_succeeded_request +from ._request_builders import build_delete202_retry200_request +from ._request_builders import build_delete202_no_retry204_request +from ._request_builders import build_delete_no_header_in_retry_request +from ._request_builders import build_delete_async_no_header_in_retry_request +from ._request_builders import build_delete_async_retry_succeeded_request +from ._request_builders import build_delete_async_no_retry_succeeded_request +from ._request_builders import build_delete_async_retry_failed_request +from ._request_builders import build_delete_async_retrycanceled_request +from ._request_builders import build_post200_with_payload_request +from ._request_builders import build_post202_retry200_request +from ._request_builders import build_post202_no_retry204_request +from ._request_builders import build_post_double_headers_final_location_get_request +from ._request_builders import build_post_double_headers_final_azure_header_get_request +from ._request_builders import build_post_double_headers_final_azure_header_get_default_request +from ._request_builders import build_post_async_retry_succeeded_request +from ._request_builders import build_post_async_no_retry_succeeded_request +from ._request_builders import build_post_async_retry_failed_request +from ._request_builders import build_post_async_retrycanceled_request __all__ = [ "build_put200_succeeded_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py index aef34a16028..68dc4d89701 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders.py @@ -22,13 +22,11 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload def build_put200_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -69,9 +67,8 @@ def build_put200_succeeded_request( @overload def build_put200_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -90,10 +87,7 @@ def build_put200_succeeded_request( """ -def build_put200_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put200_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -113,30 +107,24 @@ def build_put200_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/200/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_patch200_succeeded_ignore_headers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. @@ -177,9 +165,8 @@ def build_patch200_succeeded_ignore_headers_request( @overload def build_patch200_succeeded_ignore_headers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. @@ -198,10 +185,7 @@ def build_patch200_succeeded_ignore_headers_request( """ -def build_patch200_succeeded_ignore_headers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch200_succeeded_ignore_headers_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request with location header. We should not have any subsequent calls after receiving this first response. @@ -221,30 +205,24 @@ def build_patch200_succeeded_ignore_headers_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/patch/200/succeeded/ignoreheaders" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) @overload def build_patch201_retry_with_async_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running patch request, service returns a 201 to the initial request with async header. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -284,9 +262,8 @@ def build_patch201_retry_with_async_header_request( @overload def build_patch201_retry_with_async_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running patch request, service returns a 201 to the initial request with async header. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -304,10 +281,7 @@ def build_patch201_retry_with_async_header_request( """ -def build_patch201_retry_with_async_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch201_retry_with_async_header_request(**kwargs: Any) -> HttpRequest: """Long running patch request, service returns a 201 to the initial request with async header. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -326,30 +300,24 @@ def build_patch201_retry_with_async_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/patch/201/retry/onlyAsyncHeader" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) @overload def build_patch202_retry_with_async_and_location_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running patch request, service returns a 202 to the initial request with async and location header. @@ -390,9 +358,8 @@ def build_patch202_retry_with_async_and_location_header_request( @overload def build_patch202_retry_with_async_and_location_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running patch request, service returns a 202 to the initial request with async and location header. @@ -411,10 +378,7 @@ def build_patch202_retry_with_async_and_location_header_request( """ -def build_patch202_retry_with_async_and_location_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch202_retry_with_async_and_location_header_request(**kwargs: Any) -> HttpRequest: """Long running patch request, service returns a 202 to the initial request with async and location header. @@ -434,30 +398,24 @@ def build_patch202_retry_with_async_and_location_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/patch/202/retry/asyncAndLocationHeader" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) @overload def build_put201_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -498,9 +456,8 @@ def build_put201_succeeded_request( @overload def build_put201_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -519,10 +476,7 @@ def build_put201_succeeded_request( """ -def build_put201_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put201_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -542,29 +496,21 @@ def build_put201_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/201/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_post202_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_list_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -579,27 +525,21 @@ def build_post202_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/list" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_put200_succeeded_no_state_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -640,9 +580,8 @@ def build_put200_succeeded_no_state_request( @overload def build_put200_succeeded_no_state_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -661,10 +600,7 @@ def build_put200_succeeded_no_state_request( """ -def build_put200_succeeded_no_state_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put200_succeeded_no_state_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -684,30 +620,24 @@ def build_put200_succeeded_no_state_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/200/succeeded/nostate" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -749,9 +679,8 @@ def build_put202_retry200_request( @overload def build_put202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -771,10 +700,7 @@ def build_put202_retry200_request( """ -def build_put202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put202_retry200_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -795,30 +721,24 @@ def build_put202_retry200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/202/retry/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -860,9 +780,8 @@ def build_put201_creating_succeeded200_request( @overload def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -882,10 +801,7 @@ def build_put201_creating_succeeded200_request( """ -def build_put201_creating_succeeded200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put201_creating_succeeded200_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -906,30 +822,24 @@ def build_put201_creating_succeeded200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/201/creating/succeeded/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put200_updating_succeeded204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -971,9 +881,8 @@ def build_put200_updating_succeeded204_request( @overload def build_put200_updating_succeeded204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -993,10 +902,7 @@ def build_put200_updating_succeeded204_request( """ -def build_put200_updating_succeeded204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put200_updating_succeeded204_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -1017,30 +923,24 @@ def build_put200_updating_succeeded204_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/200/updating/succeeded/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put201_creating_failed200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -1082,9 +982,8 @@ def build_put201_creating_failed200_request( @overload def build_put201_creating_failed200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -1104,10 +1003,7 @@ def build_put201_creating_failed200_request( """ -def build_put201_creating_failed200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put201_creating_failed200_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -1128,30 +1024,24 @@ def build_put201_creating_failed200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/201/created/failed/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put200_acceptedcanceled200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -1193,9 +1083,8 @@ def build_put200_acceptedcanceled200_request( @overload def build_put200_acceptedcanceled200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -1215,10 +1104,7 @@ def build_put200_acceptedcanceled200_request( """ -def build_put200_acceptedcanceled200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put200_acceptedcanceled200_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -1239,30 +1125,24 @@ def build_put200_acceptedcanceled200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/200/accepted/canceled/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_no_header_in_retry_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -1303,9 +1183,8 @@ def build_put_no_header_in_retry_request( @overload def build_put_no_header_in_retry_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -1324,10 +1203,7 @@ def build_put_no_header_in_retry_request( """ -def build_put_no_header_in_retry_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_no_header_in_retry_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -1347,30 +1223,24 @@ def build_put_no_header_in_retry_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/put/noheader/202/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1412,9 +1282,8 @@ def build_put_async_retry_succeeded_request( @overload def build_put_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1434,10 +1303,7 @@ def build_put_async_retry_succeeded_request( """ -def build_put_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1458,30 +1324,24 @@ def build_put_async_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putasync/retry/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_no_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1523,9 +1383,8 @@ def build_put_async_no_retry_succeeded_request( @overload def build_put_async_no_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1545,10 +1404,7 @@ def build_put_async_no_retry_succeeded_request( """ -def build_put_async_no_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_no_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1569,30 +1425,24 @@ def build_put_async_no_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putasync/noretry/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_retry_failed_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1634,9 +1484,8 @@ def build_put_async_retry_failed_request( @overload def build_put_async_retry_failed_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1656,10 +1505,7 @@ def build_put_async_retry_failed_request( """ -def build_put_async_retry_failed_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_retry_failed_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1680,30 +1526,24 @@ def build_put_async_retry_failed_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putasync/retry/failed" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_no_retrycanceled_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1745,9 +1585,8 @@ def build_put_async_no_retrycanceled_request( @overload def build_put_async_no_retrycanceled_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1767,10 +1606,7 @@ def build_put_async_no_retrycanceled_request( """ -def build_put_async_no_retrycanceled_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_no_retrycanceled_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1791,30 +1627,24 @@ def build_put_async_no_retrycanceled_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putasync/noretry/canceled" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_no_header_in_retry_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -1856,9 +1686,8 @@ def build_put_async_no_header_in_retry_request( @overload def build_put_async_no_header_in_retry_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -1878,10 +1707,7 @@ def build_put_async_no_header_in_retry_request( """ -def build_put_async_no_header_in_retry_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_no_header_in_retry_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 202 to the initial request with Azure-AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -1902,30 +1728,24 @@ def build_put_async_no_header_in_retry_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putasync/noheader/201/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_non_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1954,9 +1774,8 @@ def build_put_non_resource_request( @overload def build_put_non_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1974,10 +1793,7 @@ def build_put_non_resource_request( """ -def build_put_non_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_non_resource_request(**kwargs: Any) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1996,30 +1812,24 @@ def build_put_non_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putnonresource/202/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_non_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2048,9 +1858,8 @@ def build_put_async_non_resource_request( @overload def build_put_async_non_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2068,10 +1877,7 @@ def build_put_async_non_resource_request( """ -def build_put_async_non_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_non_resource_request(**kwargs: Any) -> HttpRequest: """Long running put request with non resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2090,30 +1896,24 @@ def build_put_async_non_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putnonresourceasync/202/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_sub_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2147,9 +1947,8 @@ def build_put_sub_resource_request( @overload def build_put_sub_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2167,10 +1966,7 @@ def build_put_sub_resource_request( """ -def build_put_sub_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_sub_resource_request(**kwargs: Any) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2189,30 +1985,24 @@ def build_put_sub_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putsubresource/202/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_sub_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2246,9 +2036,8 @@ def build_put_async_sub_resource_request( @overload def build_put_async_sub_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2266,10 +2055,7 @@ def build_put_async_sub_resource_request( """ -def build_put_async_sub_resource_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_sub_resource_request(**kwargs: Any) -> HttpRequest: """Long running put request with sub resource. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2288,29 +2074,21 @@ def build_put_async_sub_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/putsubresourceasync/202/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_delete_provisioning202_accepted200_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_provisioning202_accepted200_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2326,26 +2104,18 @@ def build_delete_provisioning202_accepted200_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/delete/provisioning/202/accepted/200/succeeded" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_provisioning202_deleting_failed200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_provisioning202_deleting_failed200_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -2361,26 +2131,18 @@ def build_delete_provisioning202_deleting_failed200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/delete/provisioning/202/deleting/200/failed" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_provisioning202_deletingcanceled200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_provisioning202_deletingcanceled200_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -2396,26 +2158,18 @@ def build_delete_provisioning202_deletingcanceled200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/delete/provisioning/202/deleting/200/canceled" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete204_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete204_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running delete succeeds and returns right away. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2429,26 +2183,18 @@ def build_delete204_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/delete/204/succeeded" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete202_retry200_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2463,26 +2209,18 @@ def build_delete202_retry200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/delete/202/retry/200" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete202_no_retry204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete202_no_retry204_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2497,26 +2235,18 @@ def build_delete202_no_retry204_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/delete/202/noretry/204" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_no_header_in_retry_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_no_header_in_retry_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -2531,26 +2261,18 @@ def build_delete_no_header_in_retry_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/delete/noheader" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_no_header_in_retry_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_no_header_in_retry_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -2565,26 +2287,18 @@ def build_delete_async_no_header_in_retry_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/deleteasync/noheader/202/204" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2599,26 +2313,18 @@ def build_delete_async_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/deleteasync/retry/succeeded" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_no_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_no_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2633,26 +2339,18 @@ def build_delete_async_no_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/deleteasync/noretry/succeeded" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_retry_failed_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_retry_failed_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2667,26 +2365,18 @@ def build_delete_async_retry_failed_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/deleteasync/retry/failed" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_retrycanceled_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_retrycanceled_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2701,26 +2391,18 @@ def build_delete_async_retrycanceled_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/deleteasync/retry/canceled" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_post200_with_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post200_with_payload_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -2735,27 +2417,21 @@ def build_post200_with_payload_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/post/payload/200" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -2796,9 +2472,8 @@ def build_post202_retry200_request( @overload def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -2817,10 +2492,7 @@ def build_post202_retry200_request( """ -def build_post202_retry200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_retry200_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -2840,30 +2512,24 @@ def build_post202_retry200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/post/202/retry/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post202_no_retry204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -2904,9 +2570,8 @@ def build_post202_no_retry204_request( @overload def build_post202_no_retry204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -2925,10 +2590,7 @@ def build_post202_no_retry204_request( """ -def build_post202_no_retry204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_no_retry204_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -2948,29 +2610,21 @@ def build_post202_no_retry204_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/post/202/noretry/204" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_double_headers_final_location_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_double_headers_final_location_get_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -2986,26 +2640,18 @@ def build_post_double_headers_final_location_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/LROPostDoubleHeadersFinalLocationGet" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_double_headers_final_azure_header_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_double_headers_final_azure_header_get_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object. @@ -3021,26 +2667,18 @@ def build_post_double_headers_final_azure_header_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/LROPostDoubleHeadersFinalAzureHeaderGet" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_double_headers_final_azure_header_get_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_double_headers_final_azure_header_get_default_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object if you support initial Autorest behavior. @@ -3056,27 +2694,21 @@ def build_post_double_headers_final_azure_header_get_default_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3118,9 +2750,8 @@ def build_post_async_retry_succeeded_request( @overload def build_post_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3140,10 +2771,7 @@ def build_post_async_retry_succeeded_request( """ -def build_post_async_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3164,30 +2792,24 @@ def build_post_async_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/postasync/retry/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_no_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3229,9 +2851,8 @@ def build_post_async_no_retry_succeeded_request( @overload def build_post_async_no_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3251,10 +2872,7 @@ def build_post_async_no_retry_succeeded_request( """ -def build_post_async_no_retry_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_no_retry_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3275,30 +2893,24 @@ def build_post_async_no_retry_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/postasync/noretry/succeeded" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_retry_failed_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3340,9 +2952,8 @@ def build_post_async_retry_failed_request( @overload def build_post_async_retry_failed_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3362,10 +2973,7 @@ def build_post_async_retry_failed_request( """ -def build_post_async_retry_failed_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_retry_failed_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3386,30 +2994,24 @@ def build_post_async_retry_failed_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/postasync/retry/failed" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_retrycanceled_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3451,9 +3053,8 @@ def build_post_async_retrycanceled_request( @overload def build_post_async_retrycanceled_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3473,10 +3074,7 @@ def build_post_async_retrycanceled_request( """ -def build_post_async_retrycanceled_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_retrycanceled_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3497,20 +3095,15 @@ def build_post_async_retrycanceled_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/postasync/retry/canceled" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py deleted file mode 100644 index ccaf76d0938..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lros/_request_builders_py3.py +++ /dev/null @@ -1,3580 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_put200_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put200_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put200_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/200/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_patch200_succeeded_ignore_headers_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request with location header. We - should not have any subsequent calls after receiving this first response. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to patch. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_patch200_succeeded_ignore_headers_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request with location header. We - should not have any subsequent calls after receiving this first response. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to patch. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_patch200_succeeded_ignore_headers_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request with location header. We - should not have any subsequent calls after receiving this first response. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to patch. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/patch/200/succeeded/ignoreheaders" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_patch201_retry_with_async_header_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running patch request, service returns a 201 to the initial request with async header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to patch. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_patch201_retry_with_async_header_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running patch request, service returns a 201 to the initial request with async header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to patch. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_patch201_retry_with_async_header_request( - **kwargs: Any -) -> HttpRequest: - """Long running patch request, service returns a 201 to the initial request with async header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to patch. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/patch/201/retry/onlyAsyncHeader" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_patch202_retry_with_async_and_location_header_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running patch request, service returns a 202 to the initial request with async and - location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to patch. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_patch202_retry_with_async_and_location_header_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running patch request, service returns a 202 to the initial request with async and - location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to patch. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_patch202_retry_with_async_and_location_header_request( - **kwargs: Any -) -> HttpRequest: - """Long running patch request, service returns a 202 to the initial request with async and - location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to patch. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/patch/202/retry/asyncAndLocationHeader" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put201_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put201_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put201_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/201/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post202_list_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 with empty body to first request, returns a 200 - with body [{ 'id': '100', 'name': 'foo' }]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/list" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put200_succeeded_no_state_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - does not contain ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put200_succeeded_no_state_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - does not contain ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put200_succeeded_no_state_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - does not contain ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/200/succeeded/nostate" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put202_retry200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request, with a location header - that points to a polling URL that returns a 200 and an entity that doesn't contains - ProvisioningState. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put202_retry200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request, with a location header - that points to a polling URL that returns a 200 and an entity that doesn't contains - ProvisioningState. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put202_retry200_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request, with a location header - that points to a polling URL that returns a 200 and an entity that doesn't contains - ProvisioningState. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/202/retry/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put201_creating_succeeded200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put201_creating_succeeded200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put201_creating_succeeded200_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/201/creating/succeeded/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put200_updating_succeeded204_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put200_updating_succeeded204_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put200_updating_succeeded204_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/200/updating/succeeded/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put201_creating_failed200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Created’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Failed’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put201_creating_failed200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Created’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Failed’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put201_creating_failed200_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Created’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Failed’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/201/created/failed/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put200_acceptedcanceled200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Canceled’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put200_acceptedcanceled200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Canceled’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put200_acceptedcanceled200_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Canceled’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/200/accepted/canceled/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_no_header_in_retry_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request with location header. - Subsequent calls to operation status do not contain location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_no_header_in_retry_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request with location header. - Subsequent calls to operation status do not contain location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_no_header_in_retry_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request with location header. - Subsequent calls to operation status do not contain location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/put/noheader/202/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_retry_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_retry_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putasync/retry/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_no_retry_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_no_retry_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_no_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putasync/noretry/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_retry_failed_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_retry_failed_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_retry_failed_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putasync/retry/failed" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_no_retrycanceled_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_no_retrycanceled_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_no_retrycanceled_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putasync/noretry/canceled" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_no_header_in_retry_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request with - Azure-AsyncOperation header. Subsequent calls to operation status do not contain - Azure-AsyncOperation header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_no_header_in_retry_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request with - Azure-AsyncOperation header. Subsequent calls to operation status do not contain - Azure-AsyncOperation header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_no_header_in_retry_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 202 to the initial request with - Azure-AsyncOperation header. Subsequent calls to operation status do not contain - Azure-AsyncOperation header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putasync/noheader/201/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_non_resource_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request with non resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: sku to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. - "name": "str" # Optional. - } - """ - - -@overload -def build_put_non_resource_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request with non resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: sku to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_non_resource_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request with non resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: sku to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putnonresource/202/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_non_resource_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request with non resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Sku to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. - "name": "str" # Optional. - } - """ - - -@overload -def build_put_async_non_resource_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request with non resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Sku to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_non_resource_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request with non resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Sku to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putnonresourceasync/202/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_sub_resource_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request with sub resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Sub Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Sub Resource Id. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - } - } - """ - - -@overload -def build_put_sub_resource_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request with sub resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Sub Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_sub_resource_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request with sub resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Sub Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putsubresource/202/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_sub_resource_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request with sub resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Sub Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Sub Resource Id. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - } - } - """ - - -@overload -def build_put_async_sub_resource_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request with sub resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Sub Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_sub_resource_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request with sub resource. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Sub Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/putsubresourceasync/202/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_provisioning202_accepted200_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/delete/provisioning/202/accepted/200/succeeded" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_provisioning202_deleting_failed200_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Failed’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/delete/provisioning/202/deleting/200/failed" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_provisioning202_deletingcanceled200_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a - ‘200’ with ProvisioningState=’Canceled’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/delete/provisioning/202/deleting/200/canceled" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete204_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete succeeds and returns right away. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/delete/204/succeeded" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete202_retry200_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Polls return this - value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/delete/202/retry/200" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete202_no_retry204_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Polls return this - value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/delete/202/noretry/204" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_no_header_in_retry_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a location header in the initial request. - Subsequent calls to operation status do not contain location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/delete/noheader" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_no_header_in_retry_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns an Azure-AsyncOperation header in the initial - request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/deleteasync/noheader/202/204" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/deleteasync/retry/succeeded" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_no_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/deleteasync/noretry/succeeded" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_retry_failed_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/deleteasync/retry/failed" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_retrycanceled_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/deleteasync/retry/canceled" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post200_with_payload_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with 'Location' - header. Poll returns a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/post/payload/200" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post202_retry200_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with 'Location' and - 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post202_retry200_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with 'Location' and - 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post202_retry200_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with 'Location' and - 'Retry-After' headers, Polls return a 200 with a response body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/post/202/retry/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post202_no_retry204_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with 'Location' - header, 204 with noresponse body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post202_no_retry204_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with 'Location' - header, 204 with noresponse body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post202_no_retry204_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with 'Location' - header, 204 with noresponse body after success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/post/202/noretry/204" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_double_headers_final_location_get_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request with both Location and - Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final - object. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/LROPostDoubleHeadersFinalLocationGet" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_double_headers_final_azure_header_get_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request with both Location and - Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the - final object. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/LROPostDoubleHeadersFinalAzureHeaderGet" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_double_headers_final_azure_header_get_default_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request with both Location and - Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the - final object if you support initial Autorest behavior. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_retry_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_retry_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/postasync/retry/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_no_retry_succeeded_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_no_retry_succeeded_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_no_retry_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/postasync/noretry/succeeded" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_retry_failed_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_retry_failed_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_retry_failed_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/postasync/retry/failed" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_retrycanceled_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_retrycanceled_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_retrycanceled_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/postasync/retry/canceled" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/__init__.py index 37765c4463f..276eb5712cd 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/__init__.py @@ -6,60 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put_non_retry400_request - from ._request_builders_py3 import build_put_non_retry201_creating400_request - from ._request_builders_py3 import build_put_non_retry201_creating400_invalid_json_request - from ._request_builders_py3 import build_put_async_relative_retry400_request - from ._request_builders_py3 import build_delete_non_retry400_request - from ._request_builders_py3 import build_delete202_non_retry400_request - from ._request_builders_py3 import build_delete_async_relative_retry400_request - from ._request_builders_py3 import build_post_non_retry400_request - from ._request_builders_py3 import build_post202_non_retry400_request - from ._request_builders_py3 import build_post_async_relative_retry400_request - from ._request_builders_py3 import build_put_error201_no_provisioning_state_payload_request - from ._request_builders_py3 import build_put_async_relative_retry_no_status_request - from ._request_builders_py3 import build_put_async_relative_retry_no_status_payload_request - from ._request_builders_py3 import build_delete204_succeeded_request - from ._request_builders_py3 import build_delete_async_relative_retry_no_status_request - from ._request_builders_py3 import build_post202_no_location_request - from ._request_builders_py3 import build_post_async_relative_retry_no_payload_request - from ._request_builders_py3 import build_put200_invalid_json_request - from ._request_builders_py3 import build_put_async_relative_retry_invalid_header_request - from ._request_builders_py3 import build_put_async_relative_retry_invalid_json_polling_request - from ._request_builders_py3 import build_delete202_retry_invalid_header_request - from ._request_builders_py3 import build_delete_async_relative_retry_invalid_header_request - from ._request_builders_py3 import build_delete_async_relative_retry_invalid_json_polling_request - from ._request_builders_py3 import build_post202_retry_invalid_header_request - from ._request_builders_py3 import build_post_async_relative_retry_invalid_header_request - from ._request_builders_py3 import build_post_async_relative_retry_invalid_json_polling_request -except (SyntaxError, ImportError): - from ._request_builders import build_put_non_retry400_request # type: ignore - from ._request_builders import build_put_non_retry201_creating400_request # type: ignore - from ._request_builders import build_put_non_retry201_creating400_invalid_json_request # type: ignore - from ._request_builders import build_put_async_relative_retry400_request # type: ignore - from ._request_builders import build_delete_non_retry400_request # type: ignore - from ._request_builders import build_delete202_non_retry400_request # type: ignore - from ._request_builders import build_delete_async_relative_retry400_request # type: ignore - from ._request_builders import build_post_non_retry400_request # type: ignore - from ._request_builders import build_post202_non_retry400_request # type: ignore - from ._request_builders import build_post_async_relative_retry400_request # type: ignore - from ._request_builders import build_put_error201_no_provisioning_state_payload_request # type: ignore - from ._request_builders import build_put_async_relative_retry_no_status_request # type: ignore - from ._request_builders import build_put_async_relative_retry_no_status_payload_request # type: ignore - from ._request_builders import build_delete204_succeeded_request # type: ignore - from ._request_builders import build_delete_async_relative_retry_no_status_request # type: ignore - from ._request_builders import build_post202_no_location_request # type: ignore - from ._request_builders import build_post_async_relative_retry_no_payload_request # type: ignore - from ._request_builders import build_put200_invalid_json_request # type: ignore - from ._request_builders import build_put_async_relative_retry_invalid_header_request # type: ignore - from ._request_builders import build_put_async_relative_retry_invalid_json_polling_request # type: ignore - from ._request_builders import build_delete202_retry_invalid_header_request # type: ignore - from ._request_builders import build_delete_async_relative_retry_invalid_header_request # type: ignore - from ._request_builders import build_delete_async_relative_retry_invalid_json_polling_request # type: ignore - from ._request_builders import build_post202_retry_invalid_header_request # type: ignore - from ._request_builders import build_post_async_relative_retry_invalid_header_request # type: ignore - from ._request_builders import build_post_async_relative_retry_invalid_json_polling_request # type: ignore +from ._request_builders import build_put_non_retry400_request +from ._request_builders import build_put_non_retry201_creating400_request +from ._request_builders import build_put_non_retry201_creating400_invalid_json_request +from ._request_builders import build_put_async_relative_retry400_request +from ._request_builders import build_delete_non_retry400_request +from ._request_builders import build_delete202_non_retry400_request +from ._request_builders import build_delete_async_relative_retry400_request +from ._request_builders import build_post_non_retry400_request +from ._request_builders import build_post202_non_retry400_request +from ._request_builders import build_post_async_relative_retry400_request +from ._request_builders import build_put_error201_no_provisioning_state_payload_request +from ._request_builders import build_put_async_relative_retry_no_status_request +from ._request_builders import build_put_async_relative_retry_no_status_payload_request +from ._request_builders import build_delete204_succeeded_request +from ._request_builders import build_delete_async_relative_retry_no_status_request +from ._request_builders import build_post202_no_location_request +from ._request_builders import build_post_async_relative_retry_no_payload_request +from ._request_builders import build_put200_invalid_json_request +from ._request_builders import build_put_async_relative_retry_invalid_header_request +from ._request_builders import build_put_async_relative_retry_invalid_json_polling_request +from ._request_builders import build_delete202_retry_invalid_header_request +from ._request_builders import build_delete_async_relative_retry_invalid_header_request +from ._request_builders import build_delete_async_relative_retry_invalid_json_polling_request +from ._request_builders import build_post202_retry_invalid_header_request +from ._request_builders import build_post_async_relative_retry_invalid_header_request +from ._request_builders import build_post_async_relative_retry_invalid_json_polling_request __all__ = [ "build_put_non_retry400_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py index 12690092fc3..447bdf1ba33 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders.py @@ -22,13 +22,11 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload def build_put_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 400 to the initial request. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -68,9 +66,8 @@ def build_put_non_retry400_request( @overload def build_put_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 400 to the initial request. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -88,10 +85,7 @@ def build_put_non_retry400_request( """ -def build_put_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_non_retry400_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 400 to the initial request. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -110,30 +104,24 @@ def build_put_non_retry400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/put/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_non_retry201_creating400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -174,9 +162,8 @@ def build_put_non_retry201_creating400_request( @overload def build_put_non_retry201_creating400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -195,10 +182,7 @@ def build_put_non_retry201_creating400_request( """ -def build_put_non_retry201_creating400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_non_retry201_creating400_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -218,30 +202,24 @@ def build_put_non_retry201_creating400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/put/201/creating/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_non_retry201_creating400_invalid_json_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -282,9 +260,8 @@ def build_put_non_retry201_creating400_invalid_json_request( @overload def build_put_non_retry201_creating400_invalid_json_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -303,10 +280,7 @@ def build_put_non_retry201_creating400_invalid_json_request( """ -def build_put_non_retry201_creating400_invalid_json_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_non_retry201_creating400_invalid_json_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -326,30 +300,24 @@ def build_put_non_retry201_creating400_invalid_json_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/put/201/creating/400/invalidjson" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_relative_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -390,9 +358,8 @@ def build_put_async_relative_retry400_request( @overload def build_put_async_relative_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -411,10 +378,7 @@ def build_put_async_relative_retry400_request( """ -def build_put_async_relative_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_relative_retry400_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -434,29 +398,21 @@ def build_put_async_relative_retry400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/putasync/retry/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_delete_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_non_retry400_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 400 with an error body. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -470,26 +426,18 @@ def build_delete_non_retry400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/delete/400" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete202_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete202_non_retry400_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 with a location header. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -503,26 +451,18 @@ def build_delete202_non_retry400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/delete/202/retry/400" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_relative_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_relative_retry400_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -537,27 +477,21 @@ def build_delete_async_relative_retry400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/deleteasync/retry/400" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) @overload def build_post_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 400 with no error body. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -597,9 +531,8 @@ def build_post_non_retry400_request( @overload def build_post_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 400 with no error body. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -617,10 +550,7 @@ def build_post_non_retry400_request( """ -def build_post_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_non_retry400_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 400 with no error body. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -639,30 +569,24 @@ def build_post_non_retry400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/post/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post202_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 with a location header. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -702,9 +626,8 @@ def build_post202_non_retry400_request( @overload def build_post202_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 with a location header. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -722,10 +645,7 @@ def build_post202_non_retry400_request( """ -def build_post202_non_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_non_retry400_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 with a location header. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -744,30 +664,24 @@ def build_post202_non_retry400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/post/202/retry/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_relative_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -808,9 +722,8 @@ def build_post_async_relative_retry400_request( @overload def build_post_async_relative_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -829,10 +742,7 @@ def build_post_async_relative_retry400_request( """ -def build_post_async_relative_retry400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_relative_retry400_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -852,30 +762,24 @@ def build_post_async_relative_retry400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/nonretryerror/postasync/retry/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_put_error201_no_provisioning_state_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -915,9 +819,8 @@ def build_put_error201_no_provisioning_state_payload_request( @overload def build_put_error201_no_provisioning_state_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 201 to the initial request with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -935,10 +838,7 @@ def build_put_error201_no_provisioning_state_payload_request( """ -def build_put_error201_no_provisioning_state_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_error201_no_provisioning_state_payload_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 201 to the initial request with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -957,30 +857,24 @@ def build_put_error201_no_provisioning_state_payload_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/put/201/noprovisioningstatepayload" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_relative_retry_no_status_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1022,9 +916,8 @@ def build_put_async_relative_retry_no_status_request( @overload def build_put_async_relative_retry_no_status_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1044,10 +937,7 @@ def build_put_async_relative_retry_no_status_request( """ -def build_put_async_relative_retry_no_status_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_relative_retry_no_status_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1068,30 +958,24 @@ def build_put_async_relative_retry_no_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/putasync/retry/nostatus" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_relative_retry_no_status_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1133,9 +1017,8 @@ def build_put_async_relative_retry_no_status_payload_request( @overload def build_put_async_relative_retry_no_status_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1155,10 +1038,7 @@ def build_put_async_relative_retry_no_status_payload_request( """ -def build_put_async_relative_retry_no_status_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_relative_retry_no_status_payload_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1179,29 +1059,21 @@ def build_put_async_relative_retry_no_status_payload_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/putasync/retry/nostatuspayload" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_delete204_succeeded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete204_succeeded_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 204 to the initial request, indicating success. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1215,26 +1087,18 @@ def build_delete204_succeeded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/delete/204/nolocation" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_relative_retry_no_status_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_relative_retry_no_status_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1249,27 +1113,21 @@ def build_delete_async_relative_retry_no_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/deleteasync/retry/nostatus" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) @overload def build_post202_no_location_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -1310,9 +1168,8 @@ def build_post202_no_location_request( @overload def build_post202_no_location_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -1331,10 +1188,7 @@ def build_post202_no_location_request( """ -def build_post202_no_location_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_no_location_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -1354,30 +1208,24 @@ def build_post202_no_location_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/post/202/nolocation" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_relative_retry_no_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1419,9 +1267,8 @@ def build_post_async_relative_retry_no_payload_request( @overload def build_post_async_relative_retry_no_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1441,10 +1288,7 @@ def build_post_async_relative_retry_no_payload_request( """ -def build_post_async_relative_retry_no_payload_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_relative_retry_no_payload_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1465,30 +1309,24 @@ def build_post_async_relative_retry_no_payload_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/postasync/retry/nopayload" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_put200_invalid_json_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -1529,9 +1367,8 @@ def build_put200_invalid_json_request( @overload def build_put200_invalid_json_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -1550,10 +1387,7 @@ def build_put200_invalid_json_request( """ -def build_put200_invalid_json_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put200_invalid_json_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -1573,30 +1407,24 @@ def build_put200_invalid_json_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/put/200/invalidjson" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_relative_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -1638,9 +1466,8 @@ def build_put_async_relative_retry_invalid_header_request( @overload def build_put_async_relative_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -1660,10 +1487,7 @@ def build_put_async_relative_retry_invalid_header_request( """ -def build_put_async_relative_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_relative_retry_invalid_header_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -1684,30 +1508,24 @@ def build_put_async_relative_retry_invalid_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/putasync/retry/invalidheader" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_async_relative_retry_invalid_json_polling_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1749,9 +1567,8 @@ def build_put_async_relative_retry_invalid_json_polling_request( @overload def build_put_async_relative_retry_invalid_json_polling_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1771,10 +1588,7 @@ def build_put_async_relative_retry_invalid_json_polling_request( """ -def build_put_async_relative_retry_invalid_json_polling_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_async_relative_retry_invalid_json_polling_request(**kwargs: Any) -> HttpRequest: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1795,29 +1609,21 @@ def build_put_async_relative_retry_invalid_json_polling_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/putasync/retry/invalidjsonpolling" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_delete202_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete202_retry_invalid_header_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -1832,26 +1638,18 @@ def build_delete202_retry_invalid_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/delete/202/retry/invalidheader" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_relative_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_relative_retry_invalid_header_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -1866,26 +1664,18 @@ def build_delete_async_relative_retry_invalid_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/deleteasync/retry/invalidheader" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) -def build_delete_async_relative_retry_invalid_json_polling_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_async_relative_retry_invalid_json_polling_request(**kwargs: Any) -> HttpRequest: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1900,27 +1690,21 @@ def build_delete_async_relative_retry_invalid_json_polling_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/deleteasync/retry/invalidjsonpolling" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs) @overload def build_post202_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -1961,9 +1745,8 @@ def build_post202_retry_invalid_header_request( @overload def build_post202_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -1982,10 +1765,7 @@ def build_post202_retry_invalid_header_request( """ -def build_post202_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_retry_invalid_header_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -2005,30 +1785,24 @@ def build_post202_retry_invalid_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/post/202/retry/invalidheader" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_relative_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2070,9 +1844,8 @@ def build_post_async_relative_retry_invalid_header_request( @overload def build_post_async_relative_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2092,10 +1865,7 @@ def build_post_async_relative_retry_invalid_header_request( """ -def build_post_async_relative_retry_invalid_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_relative_retry_invalid_header_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2116,30 +1886,24 @@ def build_post_async_relative_retry_invalid_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/postasync/retry/invalidheader" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_async_relative_retry_invalid_json_polling_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2181,9 +1945,8 @@ def build_post_async_relative_retry_invalid_json_polling_request( @overload def build_post_async_relative_retry_invalid_json_polling_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2203,10 +1966,7 @@ def build_post_async_relative_retry_invalid_json_polling_request( """ -def build_post_async_relative_retry_invalid_json_polling_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_async_relative_retry_invalid_json_polling_request(**kwargs: Any) -> HttpRequest: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2227,20 +1987,15 @@ def build_post_async_relative_retry_invalid_json_polling_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lro/error/postasync/retry/invalidjsonpolling" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py deleted file mode 100644 index bdfa236e594..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/LroLowLevel/lrolowlevel/rest/lrosads/_request_builders_py3.py +++ /dev/null @@ -1,2292 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_put_non_retry400_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 400 to the initial request. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_non_retry400_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 400 to the initial request. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_non_retry400_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 400 to the initial request. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/put/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_non_retry201_creating400_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and - 201 response code. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_non_retry201_creating400_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and - 201 response code. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_non_retry201_creating400_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and - 201 response code. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/put/201/creating/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_non_retry201_creating400_invalid_json_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and - 201 response code. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_non_retry201_creating400_invalid_json_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and - 201 response code. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_non_retry201_creating400_invalid_json_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and - 201 response code. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/put/201/creating/400/invalidjson" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_relative_retry400_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the - endpoint indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_relative_retry400_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the - endpoint indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_relative_retry400_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the - endpoint indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/putasync/retry/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_non_retry400_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 400 with an error body. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/delete/400" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete202_non_retry400_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 with a location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/delete/202/retry/400" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_relative_retry400_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/deleteasync/retry/400" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_non_retry400_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 400 with no error body. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_non_retry400_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 400 with no error body. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_non_retry400_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 400 with no error body. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/post/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post202_non_retry400_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 with a location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post202_non_retry400_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 with a location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post202_non_retry400_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 with a location header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/post/202/retry/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_relative_retry400_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_relative_retry400_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_relative_retry400_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/nonretryerror/postasync/retry/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_error201_no_provisioning_state_payload_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_error201_no_provisioning_state_payload_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_error201_no_provisioning_state_payload_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 201 to the initial request with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/put/201/noprovisioningstatepayload" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_relative_retry_no_status_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_relative_retry_no_status_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_relative_retry_no_status_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/putasync/retry/nostatus" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_relative_retry_no_status_payload_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_relative_retry_no_status_payload_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_relative_retry_no_status_payload_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/putasync/retry/nostatuspayload" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete204_succeeded_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 204 to the initial request, indicating success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/delete/204/nolocation" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_relative_retry_no_status_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/deleteasync/retry/nostatus" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post202_no_location_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, without a location - header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post202_no_location_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, without a location - header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post202_no_location_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, without a location - header. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/post/202/nolocation" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_relative_retry_no_payload_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_relative_retry_no_payload_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_relative_retry_no_payload_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/postasync/retry/nopayload" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put200_invalid_json_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that is - not a valid json. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put200_invalid_json_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that is - not a valid json. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put200_invalid_json_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that is - not a valid json. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/put/200/invalidjson" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_relative_retry_invalid_header_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation - header is invalid. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_relative_retry_invalid_header_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation - header is invalid. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_relative_retry_invalid_header_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation - header is invalid. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/putasync/retry/invalidheader" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_async_relative_retry_invalid_json_polling_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_put_async_relative_retry_invalid_json_polling_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_async_relative_retry_invalid_json_polling_request( - **kwargs: Any -) -> HttpRequest: - """Long running put request, service returns a 200 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/putasync/retry/invalidjsonpolling" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete202_retry_invalid_header_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request receing a reponse - with an invalid 'Location' and 'Retry-After' headers. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/delete/202/retry/invalidheader" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_relative_retry_invalid_header_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. The endpoint - indicated in the Azure-AsyncOperation header is invalid. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/deleteasync/retry/invalidheader" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_async_relative_retry_invalid_json_polling_request( - **kwargs: Any -) -> HttpRequest: - """Long running delete request, service returns a 202 to the initial request. Poll the endpoint - indicated in the Azure-AsyncOperation header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/deleteasync/retry/invalidjsonpolling" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post202_retry_invalid_header_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with invalid - 'Location' and 'Retry-After' headers. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post202_retry_invalid_header_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with invalid - 'Location' and 'Retry-After' headers. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post202_retry_invalid_header_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with invalid - 'Location' and 'Retry-After' headers. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/post/202/retry/invalidheader" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_relative_retry_invalid_header_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation - header is invalid. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_relative_retry_invalid_header_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation - header is invalid. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_relative_retry_invalid_header_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation - header is invalid. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/postasync/retry/invalidheader" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_async_relative_retry_invalid_json_polling_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "provisioningState": "str", # Optional. - "provisioningStateValues": "str" # Optional. Known values are: - "Succeeded", "Failed", "canceled", "Accepted", "Creating", "Created", - "Updating", "Updated", "Deleting", "Deleted", and "OK". - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - """ - - -@overload -def build_post_async_relative_retry_invalid_json_polling_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_async_relative_retry_invalid_json_polling_request( - **kwargs: Any -) -> HttpRequest: - """Long running post request, service returns a 202 to the initial request, with an entity that - contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation - header for operation status. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Product to put. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lro/error/postasync/retry/invalidjsonpolling" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/__init__.py index 6819157cc98..08cf0a8d2e6 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_poll_with_parameterized_endpoints_request - from ._request_builders_py3 import build_poll_with_constant_parameterized_endpoints_request -except (SyntaxError, ImportError): - from ._request_builders import build_poll_with_parameterized_endpoints_request # type: ignore - from ._request_builders import build_poll_with_constant_parameterized_endpoints_request # type: ignore +from ._request_builders import build_poll_with_parameterized_endpoints_request +from ._request_builders import build_poll_with_constant_parameterized_endpoints_request __all__ = [ "build_poll_with_parameterized_endpoints_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders.py index 5a0c7e0d59a..d668c6576a9 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_poll_with_parameterized_endpoints_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_poll_with_parameterized_endpoints_request(**kwargs: Any) -> HttpRequest: """Poll with method and client level parameters in endpoint. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_poll_with_parameterized_endpoints_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lroParameterizedEndpoints" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_poll_with_constant_parameterized_endpoints_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_poll_with_constant_parameterized_endpoints_request(**kwargs: Any) -> HttpRequest: """Poll with method and client level parameters in endpoint, with a constant value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -71,23 +59,18 @@ def build_poll_with_constant_parameterized_endpoints_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str - accept = _headers.pop('Accept', "application/json") + constant_parameter = kwargs.pop("constant_parameter", "iAmConstant") # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/lroConstantParameterizedEndpoints/{constantParameter}" path_format_arguments = { - "constantParameter": _SERIALIZER.url("constant_parameter", constant_parameter, 'str', skip_quote=True), + "constantParameter": _SERIALIZER.url("constant_parameter", constant_parameter, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders_py3.py deleted file mode 100644 index a7cb4680de0..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/LroWithParameterizedEndpointsLowLevel/lrowithparameterizedendpointslowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer -from .._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_poll_with_parameterized_endpoints_request( - **kwargs: Any -) -> HttpRequest: - """Poll with method and client level parameters in endpoint. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lroParameterizedEndpoints" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_poll_with_constant_parameterized_endpoints_request( - **kwargs: Any -) -> HttpRequest: - """Poll with method and client level parameters in endpoint, with a constant value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword constant_parameter: Next link for the list operation. Default value is "iAmConstant". - Note that overriding this default value may result in unsupported behavior. - :paramtype constant_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - constant_parameter = kwargs.pop('constant_parameter', "iAmConstant") # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/lroConstantParameterizedEndpoints/{constantParameter}" - path_format_arguments = { - "constantParameter": _SERIALIZER.url("constant_parameter", constant_parameter, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_client.py index 78256c12d08..866903bc0d2 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestPagingTestService: # pylint: disable=client-accepts-api-version-k """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestPagingTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/__init__.py index 24f3b17145a..4d6ad850875 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/__init__.py @@ -6,50 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_no_item_name_pages_request - from ._request_builders_py3 import build_get_null_next_link_name_pages_request - from ._request_builders_py3 import build_get_single_pages_request - from ._request_builders_py3 import build_first_response_empty_request - from ._request_builders_py3 import build_get_multiple_pages_request - from ._request_builders_py3 import build_get_with_query_params_request - from ._request_builders_py3 import build_next_operation_with_query_params_request - from ._request_builders_py3 import build_duplicate_params_request - from ._request_builders_py3 import build_get_odata_multiple_pages_request - from ._request_builders_py3 import build_get_multiple_pages_with_offset_request - from ._request_builders_py3 import build_get_multiple_pages_retry_first_request - from ._request_builders_py3 import build_get_multiple_pages_retry_second_request - from ._request_builders_py3 import build_get_single_pages_failure_request - from ._request_builders_py3 import build_get_multiple_pages_failure_request - from ._request_builders_py3 import build_get_multiple_pages_failure_uri_request - from ._request_builders_py3 import build_get_multiple_pages_fragment_next_link_request - from ._request_builders_py3 import build_next_fragment_request - from ._request_builders_py3 import build_get_multiple_pages_fragment_with_grouping_next_link_request - from ._request_builders_py3 import build_next_fragment_with_grouping_request - from ._request_builders_py3 import build_get_multiple_pages_lro_request - from ._request_builders_py3 import build_get_paging_model_with_item_name_with_xms_client_name_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_no_item_name_pages_request # type: ignore - from ._request_builders import build_get_null_next_link_name_pages_request # type: ignore - from ._request_builders import build_get_single_pages_request # type: ignore - from ._request_builders import build_first_response_empty_request # type: ignore - from ._request_builders import build_get_multiple_pages_request # type: ignore - from ._request_builders import build_get_with_query_params_request # type: ignore - from ._request_builders import build_next_operation_with_query_params_request # type: ignore - from ._request_builders import build_duplicate_params_request # type: ignore - from ._request_builders import build_get_odata_multiple_pages_request # type: ignore - from ._request_builders import build_get_multiple_pages_with_offset_request # type: ignore - from ._request_builders import build_get_multiple_pages_retry_first_request # type: ignore - from ._request_builders import build_get_multiple_pages_retry_second_request # type: ignore - from ._request_builders import build_get_single_pages_failure_request # type: ignore - from ._request_builders import build_get_multiple_pages_failure_request # type: ignore - from ._request_builders import build_get_multiple_pages_failure_uri_request # type: ignore - from ._request_builders import build_get_multiple_pages_fragment_next_link_request # type: ignore - from ._request_builders import build_next_fragment_request # type: ignore - from ._request_builders import build_get_multiple_pages_fragment_with_grouping_next_link_request # type: ignore - from ._request_builders import build_next_fragment_with_grouping_request # type: ignore - from ._request_builders import build_get_multiple_pages_lro_request # type: ignore - from ._request_builders import build_get_paging_model_with_item_name_with_xms_client_name_request # type: ignore +from ._request_builders import build_get_no_item_name_pages_request +from ._request_builders import build_get_null_next_link_name_pages_request +from ._request_builders import build_get_single_pages_request +from ._request_builders import build_first_response_empty_request +from ._request_builders import build_get_multiple_pages_request +from ._request_builders import build_get_with_query_params_request +from ._request_builders import build_next_operation_with_query_params_request +from ._request_builders import build_duplicate_params_request +from ._request_builders import build_get_odata_multiple_pages_request +from ._request_builders import build_get_multiple_pages_with_offset_request +from ._request_builders import build_get_multiple_pages_retry_first_request +from ._request_builders import build_get_multiple_pages_retry_second_request +from ._request_builders import build_get_single_pages_failure_request +from ._request_builders import build_get_multiple_pages_failure_request +from ._request_builders import build_get_multiple_pages_failure_uri_request +from ._request_builders import build_get_multiple_pages_fragment_next_link_request +from ._request_builders import build_next_fragment_request +from ._request_builders import build_get_multiple_pages_fragment_with_grouping_next_link_request +from ._request_builders import build_next_fragment_with_grouping_request +from ._request_builders import build_get_multiple_pages_lro_request +from ._request_builders import build_get_paging_model_with_item_name_with_xms_client_name_request __all__ = [ "build_get_no_item_name_pages_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders.py index e8ffa28af4f..fb70dadfb7d 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_no_item_name_pages_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_no_item_name_pages_request(**kwargs: Any) -> HttpRequest: """A paging operation that must return result of the default 'value' node. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_get_no_item_name_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/noitemname" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_null_next_link_name_pages_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_next_link_name_pages_request(**kwargs: Any) -> HttpRequest: """A paging operation that must ignore any kind of nextLink, and stop after page 1. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -68,26 +56,18 @@ def build_get_null_next_link_name_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/nullnextlink" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_single_pages_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_single_pages_request(**kwargs: Any) -> HttpRequest: """A paging operation that finishes on the first call without a nextlink. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -101,26 +81,18 @@ def build_get_single_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/single" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_first_response_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_first_response_empty_request(**kwargs: Any) -> HttpRequest: """A paging operation whose first response's items list is empty, but still returns a next link. Second (and final) call, will give you an items list of 1. @@ -135,26 +107,20 @@ def build_first_response_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/firstResponseEmpty/1" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) def build_get_multiple_pages_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, client_request_id: Optional[str] = None, maxresults: Optional[int] = None, timeout: int = 30, **kwargs: Any +) -> HttpRequest: """A paging operation that includes a nextLink that has 10 pages. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -176,35 +142,24 @@ def build_get_multiple_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - client_request_id = kwargs.pop('client_request_id', _headers.pop('client-request-id', None)) # type: Optional[str] - maxresults = kwargs.pop('maxresults', _headers.pop('maxresults', None)) # type: Optional[int] - timeout = kwargs.pop('timeout', _headers.pop('timeout', 30)) # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple" # Construct headers if client_request_id is not None: - _headers['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') + _headers["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") if maxresults is not None: - _headers['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') + _headers["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") if timeout is not None: - _headers['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["timeout"] = _SERIALIZER.header("timeout", timeout, "int") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_with_query_params_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_with_query_params_request(*, required_query_parameter: int, **kwargs: Any) -> HttpRequest: """A paging operation that includes a next operation. It has a different query parameter from it's next operation nextOperationWithQueryParams. Returns a ProductResult. @@ -227,33 +182,23 @@ def build_get_with_query_params_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - query_constant = kwargs.pop('query_constant', _params.pop('queryConstant', True)) # type: bool - required_query_parameter = kwargs.pop('required_query_parameter') # type: int - accept = _headers.pop('Accept', "application/json") + query_constant = kwargs.pop("query_constant", _params.pop("queryConstant", True)) # type: bool + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/getWithQueryParams" # Construct parameters - _params['requiredQueryParameter'] = _SERIALIZER.query("required_query_parameter", required_query_parameter, 'int') - _params['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') + _params["requiredQueryParameter"] = _SERIALIZER.query("required_query_parameter", required_query_parameter, "int") + _params["queryConstant"] = _SERIALIZER.query("query_constant", query_constant, "bool") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_next_operation_with_query_params_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_next_operation_with_query_params_request(**kwargs: Any) -> HttpRequest: """Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -271,31 +216,22 @@ def build_next_operation_with_query_params_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - query_constant = kwargs.pop('query_constant', _params.pop('queryConstant', True)) # type: bool - accept = _headers.pop('Accept', "application/json") + query_constant = kwargs.pop("query_constant", _params.pop("queryConstant", True)) # type: bool + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/nextOperationWithQueryParams" # Construct parameters - _params['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') + _params["queryConstant"] = _SERIALIZER.query("query_constant", query_constant, "bool") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_duplicate_params_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_duplicate_params_request(*, filter: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Define ``filter`` as a query param for all calls. However, the returned next link will also include the ``filter`` as part of it. Make sure you don't end up duplicating the ``filter`` param in the url sent. @@ -314,32 +250,24 @@ def build_duplicate_params_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - filter = kwargs.pop('filter', _params.pop('$filter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/duplicateParams/1" # Construct parameters if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_odata_multiple_pages_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, client_request_id: Optional[str] = None, maxresults: Optional[int] = None, timeout: int = 30, **kwargs: Any +) -> HttpRequest: """A paging operation that includes a nextLink in odata format that has 10 pages. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -361,36 +289,31 @@ def build_get_odata_multiple_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - client_request_id = kwargs.pop('client_request_id', _headers.pop('client-request-id', None)) # type: Optional[str] - maxresults = kwargs.pop('maxresults', _headers.pop('maxresults', None)) # type: Optional[int] - timeout = kwargs.pop('timeout', _headers.pop('timeout', 30)) # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/odata" # Construct headers if client_request_id is not None: - _headers['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') + _headers["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") if maxresults is not None: - _headers['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') + _headers["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") if timeout is not None: - _headers['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["timeout"] = _SERIALIZER.header("timeout", timeout, "int") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) def build_get_multiple_pages_with_offset_request( - offset, # type: int - **kwargs # type: Any -): - # type: (...) -> HttpRequest + offset: int, + *, + client_request_id: Optional[str] = None, + maxresults: Optional[int] = None, + timeout: int = 30, + **kwargs: Any +) -> HttpRequest: """A paging operation that includes a nextLink that has 10 pages. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -414,40 +337,29 @@ def build_get_multiple_pages_with_offset_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - client_request_id = kwargs.pop('client_request_id', _headers.pop('client-request-id', None)) # type: Optional[str] - maxresults = kwargs.pop('maxresults', _headers.pop('maxresults', None)) # type: Optional[int] - timeout = kwargs.pop('timeout', _headers.pop('timeout', 30)) # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/withpath/{offset}" path_format_arguments = { - "offset": _SERIALIZER.url("offset", offset, 'int'), + "offset": _SERIALIZER.url("offset", offset, "int"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers if client_request_id is not None: - _headers['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') + _headers["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") if maxresults is not None: - _headers['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') + _headers["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") if timeout is not None: - _headers['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["timeout"] = _SERIALIZER.header("timeout", timeout, "int") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_multiple_pages_retry_first_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_multiple_pages_retry_first_request(**kwargs: Any) -> HttpRequest: """A paging operation that fails on the first call with 500 and then retries and then get a response including a nextLink that has 10 pages. @@ -462,26 +374,18 @@ def build_get_multiple_pages_retry_first_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/retryfirst" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_multiple_pages_retry_second_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_multiple_pages_retry_second_request(**kwargs: Any) -> HttpRequest: """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails first with 500. The client should retry and finish all 10 pages eventually. @@ -496,26 +400,18 @@ def build_get_multiple_pages_retry_second_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/retrysecond" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_single_pages_failure_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_single_pages_failure_request(**kwargs: Any) -> HttpRequest: """A paging operation that receives a 400 on the first call. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -529,26 +425,18 @@ def build_get_single_pages_failure_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/single/failure" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_multiple_pages_failure_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_multiple_pages_failure_request(**kwargs: Any) -> HttpRequest: """A paging operation that receives a 400 on the second call. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -562,26 +450,18 @@ def build_get_multiple_pages_failure_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/failure" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_multiple_pages_failure_uri_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_multiple_pages_failure_uri_request(**kwargs: Any) -> HttpRequest: """A paging operation that receives an invalid nextLink. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -595,27 +475,18 @@ def build_get_multiple_pages_failure_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/failureuri" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_multiple_pages_fragment_next_link_request( - tenant, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_multiple_pages_fragment_next_link_request(tenant: str, *, api_version: str, **kwargs: Any) -> HttpRequest: """A paging operation that doesn't return a full URL, just a fragment. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -634,38 +505,26 @@ def build_get_multiple_pages_fragment_next_link_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/fragment/{tenant}" path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, 'str'), + "tenant": _SERIALIZER.url("tenant", tenant, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api_version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_next_fragment_request( - tenant, # type: str - next_link, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_next_fragment_request(tenant: str, next_link: str, *, api_version: str, **kwargs: Any) -> HttpRequest: """A paging operation that doesn't return a full URL, just a fragment See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -686,38 +545,29 @@ def build_next_fragment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/fragment/{tenant}/{nextLink}" path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, 'str'), - "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), + "tenant": _SERIALIZER.url("tenant", tenant, "str"), + "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api_version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_multiple_pages_fragment_with_grouping_next_link_request( - tenant, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + tenant: str, *, api_version: str, **kwargs: Any +) -> HttpRequest: """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -736,38 +586,28 @@ def build_get_multiple_pages_fragment_with_grouping_next_link_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/fragmentwithgrouping/{tenant}" path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, 'str'), + "tenant": _SERIALIZER.url("tenant", tenant, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api_version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_next_fragment_with_grouping_request( - tenant, # type: str - next_link, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + tenant: str, next_link: str, *, api_version: str, **kwargs: Any +) -> HttpRequest: """A paging operation that doesn't return a full URL, just a fragment See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -788,37 +628,29 @@ def build_next_fragment_with_grouping_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}" path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, 'str'), - "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), + "tenant": _SERIALIZER.url("tenant", tenant, "str"), + "nextLink": _SERIALIZER.url("next_link", next_link, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api_version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_multiple_pages_lro_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, client_request_id: Optional[str] = None, maxresults: Optional[int] = None, timeout: int = 30, **kwargs: Any +) -> HttpRequest: """A long-running paging operation that includes a nextLink that has 10 pages. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -840,35 +672,24 @@ def build_get_multiple_pages_lro_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - client_request_id = kwargs.pop('client_request_id', _headers.pop('client-request-id', None)) # type: Optional[str] - maxresults = kwargs.pop('maxresults', _headers.pop('maxresults', None)) # type: Optional[int] - timeout = kwargs.pop('timeout', _headers.pop('timeout', 30)) # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/multiple/lro" # Construct headers if client_request_id is not None: - _headers['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') + _headers["client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") if maxresults is not None: - _headers['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') + _headers["maxresults"] = _SERIALIZER.header("maxresults", maxresults, "int") if timeout is not None: - _headers['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["timeout"] = _SERIALIZER.header("timeout", timeout, "int") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_get_paging_model_with_item_name_with_xms_client_name_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_paging_model_with_item_name_with_xms_client_name_request(**kwargs: Any) -> HttpRequest: """A paging operation that returns a paging model whose item name is is overriden by x-ms-client-name 'indexes'. @@ -883,17 +704,12 @@ def build_get_paging_model_with_item_name_with_xms_client_name_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paging/itemNameWithXMSClientName" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders_py3.py deleted file mode 100644 index 6e15b84bf27..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/PagingLowLevel/paginglowlevel/rest/paging/_request_builders_py3.py +++ /dev/null @@ -1,888 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_no_item_name_pages_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that must return result of the default 'value' node. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/noitemname" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_null_next_link_name_pages_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that must ignore any kind of nextLink, and stop after page 1. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/nullnextlink" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_single_pages_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that finishes on the first call without a nextlink. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/single" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_first_response_empty_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation whose first response's items list is empty, but still returns a next link. - Second (and final) call, will give you an items list of 1. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/firstResponseEmpty/1" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_request( - *, - client_request_id: Optional[str] = None, - maxresults: Optional[int] = None, - timeout: int = 30, - **kwargs: Any -) -> HttpRequest: - """A paging operation that includes a nextLink that has 10 pages. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword client_request_id: Default value is None. - :paramtype client_request_id: str - :keyword maxresults: Sets the maximum number of items to return in the response. Default value - is None. - :paramtype maxresults: int - :keyword timeout: Sets the maximum time that the server can spend processing the request, in - seconds. The default is 30 seconds. Default value is 30. - :paramtype timeout: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple" - - # Construct headers - if client_request_id is not None: - _headers['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') - if maxresults is not None: - _headers['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') - if timeout is not None: - _headers['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_with_query_params_request( - *, - required_query_parameter: int, - **kwargs: Any -) -> HttpRequest: - """A paging operation that includes a next operation. It has a different query parameter from it's - next operation nextOperationWithQueryParams. Returns a ProductResult. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword required_query_parameter: A required integer query parameter. Put in value '100' to - pass test. Required. - :paramtype required_query_parameter: int - :keyword query_constant: A constant. Must be True and will be passed as a query parameter to - nextOperationWithQueryParams. Default value is True. Note that overriding this default value - may result in unsupported behavior. - :paramtype query_constant: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - query_constant = kwargs.pop('query_constant', _params.pop('queryConstant', True)) # type: bool - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/getWithQueryParams" - - # Construct parameters - _params['requiredQueryParameter'] = _SERIALIZER.query("required_query_parameter", required_query_parameter, 'int') - _params['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_next_operation_with_query_params_request( - **kwargs: Any -) -> HttpRequest: - """Next operation for getWithQueryParams. Pass in next=True to pass test. Returns a ProductResult - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword query_constant: A constant. Must be True Default value is True. Note that overriding - this default value may result in unsupported behavior. - :paramtype query_constant: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - query_constant = kwargs.pop('query_constant', _params.pop('queryConstant', True)) # type: bool - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/nextOperationWithQueryParams" - - # Construct parameters - _params['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_duplicate_params_request( - *, - filter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Define ``filter`` as a query param for all calls. However, the returned next link will also - include the ``filter`` as part of it. Make sure you don't end up duplicating the ``filter`` - param in the url sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword filter: OData filter options. Pass in 'foo'. Default value is None. - :paramtype filter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/duplicateParams/1" - - # Construct parameters - if filter is not None: - _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_odata_multiple_pages_request( - *, - client_request_id: Optional[str] = None, - maxresults: Optional[int] = None, - timeout: int = 30, - **kwargs: Any -) -> HttpRequest: - """A paging operation that includes a nextLink in odata format that has 10 pages. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword client_request_id: Default value is None. - :paramtype client_request_id: str - :keyword maxresults: Sets the maximum number of items to return in the response. Default value - is None. - :paramtype maxresults: int - :keyword timeout: Sets the maximum time that the server can spend processing the request, in - seconds. The default is 30 seconds. Default value is 30. - :paramtype timeout: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/odata" - - # Construct headers - if client_request_id is not None: - _headers['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') - if maxresults is not None: - _headers['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') - if timeout is not None: - _headers['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_with_offset_request( - offset: int, - *, - client_request_id: Optional[str] = None, - maxresults: Optional[int] = None, - timeout: int = 30, - **kwargs: Any -) -> HttpRequest: - """A paging operation that includes a nextLink that has 10 pages. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param offset: Offset of return value. Required. - :type offset: int - :keyword client_request_id: Default value is None. - :paramtype client_request_id: str - :keyword maxresults: Sets the maximum number of items to return in the response. Default value - is None. - :paramtype maxresults: int - :keyword timeout: Sets the maximum time that the server can spend processing the request, in - seconds. The default is 30 seconds. Default value is 30. - :paramtype timeout: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/withpath/{offset}" - path_format_arguments = { - "offset": _SERIALIZER.url("offset", offset, 'int'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - if client_request_id is not None: - _headers['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') - if maxresults is not None: - _headers['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') - if timeout is not None: - _headers['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_retry_first_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that fails on the first call with 500 and then retries and then get a - response including a nextLink that has 10 pages. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/retryfirst" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_retry_second_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails - first with 500. The client should retry and finish all 10 pages eventually. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/retrysecond" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_single_pages_failure_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that receives a 400 on the first call. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/single/failure" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_failure_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that receives a 400 on the second call. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/failure" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_failure_uri_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that receives an invalid nextLink. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/failureuri" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_fragment_next_link_request( - tenant: str, - *, - api_version: str, - **kwargs: Any -) -> HttpRequest: - """A paging operation that doesn't return a full URL, just a fragment. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param tenant: Sets the tenant to use. Required. - :type tenant: str - :keyword api_version: Sets the api version to use. Required. - :paramtype api_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/fragment/{tenant}" - path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_next_fragment_request( - tenant: str, - next_link: str, - *, - api_version: str, - **kwargs: Any -) -> HttpRequest: - """A paging operation that doesn't return a full URL, just a fragment - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param tenant: Sets the tenant to use. Required. - :type tenant: str - :param next_link: Next link for list operation. Required. - :type next_link: str - :keyword api_version: Sets the api version to use. Required. - :paramtype api_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/fragment/{tenant}/{nextLink}" - path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, 'str'), - "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_fragment_with_grouping_next_link_request( - tenant: str, - *, - api_version: str, - **kwargs: Any -) -> HttpRequest: - """A paging operation that doesn't return a full URL, just a fragment with parameters grouped. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param tenant: Sets the tenant to use. Required. - :type tenant: str - :keyword api_version: Sets the api version to use. Required. - :paramtype api_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/fragmentwithgrouping/{tenant}" - path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_next_fragment_with_grouping_request( - tenant: str, - next_link: str, - *, - api_version: str, - **kwargs: Any -) -> HttpRequest: - """A paging operation that doesn't return a full URL, just a fragment - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param tenant: Sets the tenant to use. Required. - :type tenant: str - :param next_link: Next link for list operation. Required. - :type next_link: str - :keyword api_version: Sets the api version to use. Required. - :paramtype api_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}" - path_format_arguments = { - "tenant": _SERIALIZER.url("tenant", tenant, 'str'), - "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api_version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_multiple_pages_lro_request( - *, - client_request_id: Optional[str] = None, - maxresults: Optional[int] = None, - timeout: int = 30, - **kwargs: Any -) -> HttpRequest: - """A long-running paging operation that includes a nextLink that has 10 pages. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword client_request_id: Default value is None. - :paramtype client_request_id: str - :keyword maxresults: Sets the maximum number of items to return in the response. Default value - is None. - :paramtype maxresults: int - :keyword timeout: Sets the maximum time that the server can spend processing the request, in - seconds. The default is 30 seconds. Default value is 30. - :paramtype timeout: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/multiple/lro" - - # Construct headers - if client_request_id is not None: - _headers['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str') - if maxresults is not None: - _headers['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int') - if timeout is not None: - _headers['timeout'] = _SERIALIZER.header("timeout", timeout, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_paging_model_with_item_name_with_xms_client_name_request( - **kwargs: Any -) -> HttpRequest: - """A paging operation that returns a paging model whose item name is is overriden by - x-ms-client-name 'indexes'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paging/itemNameWithXMSClientName" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_client.py index 4116dcd465b..ddc47e89c67 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/_client.py @@ -45,7 +45,6 @@ def __init__( endpoint: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = StorageManagementClientConfiguration( subscription_id=subscription_id, credential=credential, **kwargs ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/__init__.py index 553b7460908..2386f8655b7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/__init__.py @@ -6,26 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_check_name_availability_request - from ._request_builders_py3 import build_create_request - from ._request_builders_py3 import build_delete_request - from ._request_builders_py3 import build_get_properties_request - from ._request_builders_py3 import build_update_request - from ._request_builders_py3 import build_list_keys_request - from ._request_builders_py3 import build_list_request - from ._request_builders_py3 import build_list_by_resource_group_request - from ._request_builders_py3 import build_regenerate_key_request -except (SyntaxError, ImportError): - from ._request_builders import build_check_name_availability_request # type: ignore - from ._request_builders import build_create_request # type: ignore - from ._request_builders import build_delete_request # type: ignore - from ._request_builders import build_get_properties_request # type: ignore - from ._request_builders import build_update_request # type: ignore - from ._request_builders import build_list_keys_request # type: ignore - from ._request_builders import build_list_request # type: ignore - from ._request_builders import build_list_by_resource_group_request # type: ignore - from ._request_builders import build_regenerate_key_request # type: ignore +from ._request_builders import build_check_name_availability_request +from ._request_builders import build_create_request +from ._request_builders import build_delete_request +from ._request_builders import build_get_properties_request +from ._request_builders import build_update_request +from ._request_builders import build_list_keys_request +from ._request_builders import build_list_request +from ._request_builders import build_list_by_resource_group_request +from ._request_builders import build_regenerate_key_request __all__ = [ "build_check_name_availability_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py index 50f650b8785..550a0044ad7 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders.py @@ -23,14 +23,11 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload def build_check_name_availability_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Checks that account name is valid and is not in use. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -65,10 +62,8 @@ def build_check_name_availability_request( @overload def build_check_name_availability_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + subscription_id: str, *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Checks that account name is valid and is not in use. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -91,11 +86,7 @@ def build_check_name_availability_request( """ -def build_check_name_availability_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """Checks that account name is valid and is not in use. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -120,43 +111,39 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @overload def build_create_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSON, + content_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of @@ -208,12 +195,14 @@ def build_create_request( @overload def build_create_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + content: IO, + content_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of @@ -245,12 +234,8 @@ def build_create_request( def build_create_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of @@ -284,44 +269,34 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Deletes a storage account in Microsoft Azure. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -345,35 +320,26 @@ def build_delete_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_get_properties_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys. @@ -400,42 +366,38 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @overload def build_update_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSON, + content_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. This API can only be used to update one of tags, @@ -500,12 +462,14 @@ def build_update_request( @overload def build_update_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + content: IO, + content_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. This API can only be used to update one of tags, @@ -541,12 +505,8 @@ def build_update_request( def build_update_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Updates the account type or tags for a storage account. It can also be used to add a custom domain (note that custom domains cannot be added via the Create operation). Only one custom domain is supported per storage account. This API can only be used to update one of tags, @@ -583,44 +543,34 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) def build_list_keys_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Lists the access keys for the specified storage account. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -643,39 +593,29 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys" # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. @@ -694,38 +634,27 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: """Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. @@ -747,41 +676,39 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts" + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts" + ) path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @overload def build_regenerate_key_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + json: JSON, + content_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Regenerates the access keys for the specified storage account. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -819,12 +746,14 @@ def build_regenerate_key_request( @overload def build_regenerate_key_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, + account_name: str, + subscription_id: str, + *, + content: IO, + content_type: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """Regenerates the access keys for the specified storage account. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -853,12 +782,8 @@ def build_regenerate_key_request( def build_regenerate_key_request( - resource_group_name, # type: str - account_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Regenerates the access keys for the specified storage account. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -889,32 +814,26 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey" # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py deleted file mode 100644 index 3da71eb0e15..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/storage_accounts/_request_builders_py3.py +++ /dev/null @@ -1,927 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_check_name_availability_request( - subscription_id: str, - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Checks that account name is valid and is not in use. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword json: The name of the storage account within the specified resource group. Storage - account names must be between 3 and 24 characters in length and use numbers and lower-case - letters only. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "name": "str", # Required. - "type": "Microsoft.Storage/storageAccounts" # Optional. Default value is - "Microsoft.Storage/storageAccounts". - } - """ - - -@overload -def build_check_name_availability_request( - subscription_id: str, - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Checks that account name is valid and is not in use. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword content: The name of the storage account within the specified resource group. Storage - account names must be between 3 and 24 characters in length and use numbers and lower-case - letters only. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_check_name_availability_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Checks that account name is valid and is not in use. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword json: The name of the storage account within the specified resource group. Storage - account names must be between 3 and 24 characters in length and use numbers and lower-case - letters only. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'text/json'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -@overload -def build_create_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Asynchronously creates a new storage account with the specified parameters. Existing accounts - cannot be updated with this API and should instead use the Update Storage Account API. If an - account is already created and subsequent PUT request is issued with exact same set of - properties, then HTTP 200 would be returned. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword json: The parameters to provide for the created account. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Resource location. Required. - "name": "str", # Optional. Resource name. - "properties": { - "accountType": "str" # Optional. Gets or sets the account type. - Known values are: "Standard_LRS", "Standard_ZRS", "Standard_GRS", - "Standard_RAGRS", and "Premium_LRS". - }, - "tags": { - "str": "str" # Optional. Resource tags. - }, - "type": "str" # Optional. Resource type. - } - """ - - -@overload -def build_create_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Asynchronously creates a new storage account with the specified parameters. Existing accounts - cannot be updated with this API and should instead use the Update Storage Account API. If an - account is already created and subsequent PUT request is issued with exact same set of - properties, then HTTP 200 would be returned. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword content: The parameters to provide for the created account. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_create_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Asynchronously creates a new storage account with the specified parameters. Existing accounts - cannot be updated with this API and should instead use the Update Storage Account API. If an - account is already created and subsequent PUT request is issued with exact same set of - properties, then HTTP 200 would be returned. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword json: The parameters to provide for the created account. Is either a model type or a - IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'text/json'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_delete_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Deletes a storage account in Microsoft Azure. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - **kwargs - ) - - -def build_get_properties_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Returns the properties for the specified storage account including but not limited to name, - account type, location, and account status. The ListKeys operation should be used to retrieve - storage keys. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -@overload -def build_update_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Updates the account type or tags for a storage account. It can also be used to add a custom - domain (note that custom domains cannot be added via the Create operation). Only one custom - domain is supported per storage account. This API can only be used to update one of tags, - accountType, or customDomain per call. To update multiple of these properties, call the API - multiple times with one change per call. This call does not change the storage keys for the - account. If you want to change storage account keys, use the RegenerateKey operation. The - location and name of the storage account cannot be changed after creation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword json: The parameters to update on the account. Note that only one property can be - changed at a time using this API. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. Resource Id. - "location": "str", # Resource location. Required. - "name": "str", # Optional. Resource name. - "properties": { - "accountType": "str", # Optional. Gets or sets the account type. - Note that StandardZRS and PremiumLRS accounts cannot be changed to other - account types, and other account types cannot be changed to StandardZRS or - PremiumLRS. Known values are: "Standard_LRS", "Standard_ZRS", "Standard_GRS", - "Standard_RAGRS", and "Premium_LRS". - "customDomain": { - "name": "str", # Optional. Gets or sets the custom domain - name. Name is the CNAME source. - "useSubDomain": bool # Optional. Indicates whether indirect - CName validation is enabled. Default value is false. This should only be - set on updates. - } - }, - "tags": { - "str": "str" # Optional. Resource tags. - }, - "type": "str" # Optional. Resource type. - } - """ - - -@overload -def build_update_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Updates the account type or tags for a storage account. It can also be used to add a custom - domain (note that custom domains cannot be added via the Create operation). Only one custom - domain is supported per storage account. This API can only be used to update one of tags, - accountType, or customDomain per call. To update multiple of these properties, call the API - multiple times with one change per call. This call does not change the storage keys for the - account. If you want to change storage account keys, use the RegenerateKey operation. The - location and name of the storage account cannot be changed after creation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword content: The parameters to update on the account. Note that only one property can be - changed at a time using this API. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_update_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Updates the account type or tags for a storage account. It can also be used to add a custom - domain (note that custom domains cannot be added via the Create operation). Only one custom - domain is supported per storage account. This API can only be used to update one of tags, - accountType, or customDomain per call. To update multiple of these properties, call the API - multiple times with one change per call. This call does not change the storage keys for the - account. If you want to change storage account keys, use the RegenerateKey operation. The - location and name of the storage account cannot be changed after creation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword json: The parameters to update on the account. Note that only one property can be - changed at a time using this API. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'text/json'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}" # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_list_keys_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Lists the access keys for the specified storage account. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys" # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Lists all the storage accounts available under the subscription. Note that storage keys are not - returned; use the ListKeys operation for this. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Lists all the storage accounts available under the given resource group. Note that storage keys - are not returned; use the ListKeys operation for this. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts" - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -@overload -def build_regenerate_key_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Regenerates the access keys for the specified storage account. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword json: Specifies name of the key which should be regenerated. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "keyName": "str" # Optional. Known values are: "key1" and "key2". - } - """ - - -@overload -def build_regenerate_key_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Regenerates the access keys for the specified storage account. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword content: Specifies name of the key which should be regenerated. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'text/json'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_regenerate_key_request( - resource_group_name: str, - account_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Regenerates the access keys for the specified storage account. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group within the user’s subscription. - Required. - :type resource_group_name: str - :param account_name: The name of the storage account within the specified resource group. - Storage account names must be between 3 and 24 characters in length and use numbers and - lower-case letters only. Required. - :type account_name: str - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :keyword json: Specifies name of the key which should be regenerated. Is either a model type or - a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'text/json'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey" # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "accountName": _SERIALIZER.url("account_name", account_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/__init__.py index fbe313bf81a..1930355f8e5 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_list_request -except (SyntaxError, ImportError): - from ._request_builders import build_list_request # type: ignore +from ._request_builders import build_list_request __all__ = [ "build_list_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py index 1c6ce564bfe..2f332c3cbef 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders.py @@ -16,13 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_list_request( - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: """Gets the current usage count and the limit for the resources under the subscription. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -40,27 +35,21 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json, text/json") # Construct URL _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py deleted file mode 100644 index 471d6cc78c4..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/StorageManagementClientLowLevel/storagelowlevel/rest/usage/_request_builders_py3.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Gets the current usage count and the limit for the resources under the subscription. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-05-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json, text/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/usages" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_client.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_client.py index 3c39a43a5a3..0d7d1e7a1cc 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_client.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/_client.py @@ -44,7 +44,6 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = MicrosoftAzureTestUrlConfiguration( subscription_id=subscription_id, credential=credential, **kwargs ) diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/__init__.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/__init__.py index 8b64bc9508a..3c1920b856c 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/__init__.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_sample_resource_group_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_sample_resource_group_request # type: ignore +from ._request_builders import build_get_sample_resource_group_request __all__ = [ "build_get_sample_resource_group_request", diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders.py index 0a878f535d5..8b9e58a935a 100644 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders.py +++ b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders.py @@ -16,14 +16,10 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_sample_resource_group_request( - resource_group_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Provides a resouce group with name 'testgroup101' and location 'West US'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -42,28 +38,22 @@ def build_get_sample_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2014-04-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2014-04-01-preview")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders_py3.py b/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders_py3.py deleted file mode 100644 index 42442db02e2..00000000000 --- a/test/azure/low-level/Expected/AcceptanceTests/SubscriptionIdApiVersionLowLevel/subscriptionidapiversionlowlevel/rest/group/_request_builders_py3.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_sample_resource_group_request( - resource_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Provides a resouce group with name 'testgroup101' and location 'West US'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: Resource Group name 'testgroup101'. Required. - :type resource_group_name: str - :param subscription_id: Subscription Id. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('api-version', "2014-04-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py index 26cd0601acb..c7a5fa23cd6 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py index 8147ba77745..1e42822e855 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py @@ -32,7 +32,6 @@ class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-ap """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestParameterGroupingTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py index 0a8dd656a63..a4771cc3701 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestReportServiceForAzure( """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestReportServiceForAzureConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py index 8e758206e9b..995966b97bb 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py @@ -77,7 +77,6 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestAzureSpecialParametersTestClientConfiguration( subscription_id=subscription_id, credential=credential, **kwargs ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py index c27247a53a3..12b1aad54e2 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py @@ -39,7 +39,6 @@ class AutoRestPagingTestService: # pylint: disable=client-accepts-api-version-k def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestPagingTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py index 40965249483..e7b4272fbc4 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py @@ -37,7 +37,6 @@ class AutoRestHeadExceptionTestService: # pylint: disable=client-accepts-api-ve def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestHeadExceptionTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py index 22b42fbde0f..eae619d0744 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py @@ -37,7 +37,6 @@ class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-key def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py index 3be0d5312be..32d5e042639 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py @@ -45,7 +45,6 @@ class AutoRestLongRunningOperationTestService: # pylint: disable=client-accepts def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestLongRunningOperationTestServiceConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py index a5bf6039b4b..5acb8f0a277 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py @@ -33,7 +33,6 @@ class AutoRestPagingTestService: # pylint: disable=client-accepts-api-version-k """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestPagingTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py index 9d8873c5369..78c02e764d7 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py @@ -52,7 +52,6 @@ def __init__( endpoint: str = "https://management.azure.com", **kwargs: Any ) -> None: - self._config = StorageManagementClientConfiguration( subscription_id=subscription_id, credential=credential, **kwargs ) diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py index a574d679ee0..72aaade026b 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py @@ -47,7 +47,6 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = MicrosoftAzureTestUrlConfiguration( subscription_id=subscription_id, credential=credential, **kwargs ) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/_client.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/_client.py index 02bcb2cb863..392fee42334 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/_client.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/_client.py @@ -28,7 +28,6 @@ class DPGClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/__init__.py index f325e83730d..11a2c8a0ad2 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/__init__.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_model_request - from ._request_builders_py3 import build_post_model_request - from ._request_builders_py3 import build_get_pages_request - from ._request_builders_py3 import build_lro_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_model_request # type: ignore - from ._request_builders import build_post_model_request # type: ignore - from ._request_builders import build_get_pages_request # type: ignore - from ._request_builders import build_lro_request # type: ignore +from ._request_builders import build_get_model_request +from ._request_builders import build_post_model_request +from ._request_builders import build_get_pages_request +from ._request_builders import build_lro_request __all__ = [ "build_get_model_request", diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/_request_builders.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/_request_builders.py index 92fb41b40d7..211372b9bda 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/_request_builders.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/_request_builders.py @@ -23,13 +23,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_model_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_model_request(mode: str, **kwargs: Any) -> HttpRequest: """Get models that you will either return to end users as a raw body, or with a model added during grow up. @@ -48,33 +43,26 @@ def build_get_model_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customization/model/{mode}" path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), + "mode": _SERIALIZER.url("mode", mode, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_post_model_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + mode: str, *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to take a model instead, and put in 'model' as mode. @@ -107,10 +95,8 @@ def build_post_model_request( @overload def build_post_model_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + mode: str, *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to take a model instead, and put in 'model' as mode. @@ -133,11 +119,7 @@ def build_post_model_request( """ -def build_post_model_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_model_request(mode: str, **kwargs: Any) -> HttpRequest: """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to take a model instead, and put in 'model' as mode. @@ -161,35 +143,26 @@ def build_post_model_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customization/model/{mode}" path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), + "mode": _SERIALIZER.url("mode", mode, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_pages_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_get_pages_request(mode: str, **kwargs: Any) -> HttpRequest: """Get pages that you will either return to users in pages of raw bodies, or pages of models following growup. @@ -208,32 +181,23 @@ def build_get_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customization/paging/{mode}" path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), + "mode": _SERIALIZER.url("mode", mode, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_lro_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_lro_request(mode: str, **kwargs: Any) -> HttpRequest: """Long running put request that will either return to end users a final payload of a raw body, or a final payload of a model after the SDK has grown up. @@ -252,22 +216,17 @@ def build_lro_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customization/lro/{mode}" path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), + "mode": _SERIALIZER.url("mode", mode, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/_request_builders_py3.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index d03c2304cfd..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationCustomizedLowLevel/dpgcustomizationcustomizedlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,273 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer -from .._vendor import _format_url_section - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_model_request( - mode: str, - **kwargs: Any -) -> HttpRequest: - """Get models that you will either return to end users as a raw body, or with a model added during - grow up. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customization/model/{mode}" - path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_model_request( - mode: str, - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to - take a model instead, and put in 'model' as mode. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :keyword json: Please put {'hello': 'world!'}. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "hello": "str" # Required. - } - """ - - -@overload -def build_post_model_request( - mode: str, - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to - take a model instead, and put in 'model' as mode. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :keyword content: Please put {'hello': 'world!'}. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_model_request( - mode: str, - **kwargs: Any -) -> HttpRequest: - """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to - take a model instead, and put in 'model' as mode. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :keyword json: Please put {'hello': 'world!'}. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customization/model/{mode}" - path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_pages_request( - mode: str, - **kwargs: Any -) -> HttpRequest: - """Get pages that you will either return to users in pages of raw bodies, or pages of models - following growup. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customization/paging/{mode}" - path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_lro_request( - mode: str, - **kwargs: Any -) -> HttpRequest: - """Long running put request that will either return to end users a final payload of a raw body, or - a final payload of a model after the SDK has grown up. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customization/lro/{mode}" - path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/_client.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/_client.py index 219c78806da..911f33bb87c 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/_client.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/_client.py @@ -28,7 +28,6 @@ class DPGClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/__init__.py index f325e83730d..11a2c8a0ad2 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/__init__.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_model_request - from ._request_builders_py3 import build_post_model_request - from ._request_builders_py3 import build_get_pages_request - from ._request_builders_py3 import build_lro_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_model_request # type: ignore - from ._request_builders import build_post_model_request # type: ignore - from ._request_builders import build_get_pages_request # type: ignore - from ._request_builders import build_lro_request # type: ignore +from ._request_builders import build_get_model_request +from ._request_builders import build_post_model_request +from ._request_builders import build_get_pages_request +from ._request_builders import build_lro_request __all__ = [ "build_get_model_request", diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/_request_builders.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/_request_builders.py index 92fb41b40d7..211372b9bda 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/_request_builders.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/_request_builders.py @@ -23,13 +23,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_model_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_model_request(mode: str, **kwargs: Any) -> HttpRequest: """Get models that you will either return to end users as a raw body, or with a model added during grow up. @@ -48,33 +43,26 @@ def build_get_model_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customization/model/{mode}" path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), + "mode": _SERIALIZER.url("mode", mode, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_post_model_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + mode: str, *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to take a model instead, and put in 'model' as mode. @@ -107,10 +95,8 @@ def build_post_model_request( @overload def build_post_model_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + mode: str, *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to take a model instead, and put in 'model' as mode. @@ -133,11 +119,7 @@ def build_post_model_request( """ -def build_post_model_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_model_request(mode: str, **kwargs: Any) -> HttpRequest: """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to take a model instead, and put in 'model' as mode. @@ -161,35 +143,26 @@ def build_post_model_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customization/model/{mode}" path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), + "mode": _SERIALIZER.url("mode", mode, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_pages_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_get_pages_request(mode: str, **kwargs: Any) -> HttpRequest: """Get pages that you will either return to users in pages of raw bodies, or pages of models following growup. @@ -208,32 +181,23 @@ def build_get_pages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customization/paging/{mode}" path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), + "mode": _SERIALIZER.url("mode", mode, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_lro_request( - mode, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_lro_request(mode: str, **kwargs: Any) -> HttpRequest: """Long running put request that will either return to end users a final payload of a raw body, or a final payload of a model after the SDK has grown up. @@ -252,22 +216,17 @@ def build_lro_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customization/lro/{mode}" path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), + "mode": _SERIALIZER.url("mode", mode, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/_request_builders_py3.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/_request_builders_py3.py deleted file mode 100644 index d03c2304cfd..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGCustomizationInitialLowLevel/dpgcustomizationinitiallowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,273 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer -from .._vendor import _format_url_section - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_model_request( - mode: str, - **kwargs: Any -) -> HttpRequest: - """Get models that you will either return to end users as a raw body, or with a model added during - grow up. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customization/model/{mode}" - path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_model_request( - mode: str, - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to - take a model instead, and put in 'model' as mode. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :keyword json: Please put {'hello': 'world!'}. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "hello": "str" # Required. - } - """ - - -@overload -def build_post_model_request( - mode: str, - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to - take a model instead, and put in 'model' as mode. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :keyword content: Please put {'hello': 'world!'}. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_model_request( - mode: str, - **kwargs: Any -) -> HttpRequest: - """Post either raw response as a model and pass in 'raw' for mode, or grow up your operation to - take a model instead, and put in 'model' as mode. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :keyword json: Please put {'hello': 'world!'}. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customization/model/{mode}" - path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_pages_request( - mode: str, - **kwargs: Any -) -> HttpRequest: - """Get pages that you will either return to users in pages of raw bodies, or pages of models - following growup. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customization/paging/{mode}" - path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_lro_request( - mode: str, - **kwargs: Any -) -> HttpRequest: - """Long running put request that will either return to end users a final payload of a raw body, or - a final payload of a model after the SDK has grown up. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param mode: The mode with which you'll be handling your returned body. 'raw' for just dealing - with the raw body, and 'model' if you are going to convert the raw body to a customized body - before returning to users. Required. - :type mode: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customization/lro/{mode}" - path_format_arguments = { - "mode": _SERIALIZER.url("mode", mode, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/_client.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/_client.py index 1c5eb6428e8..fe5da6335c3 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/_client.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/_client.py @@ -28,7 +28,6 @@ class DPGClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/__init__.py index 7b3b78a53ab..94039b6f3da 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/__init__.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/__init__.py @@ -6,18 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head_no_params_request - from ._request_builders_py3 import build_get_required_request - from ._request_builders_py3 import build_put_required_optional_request - from ._request_builders_py3 import build_post_parameters_request - from ._request_builders_py3 import build_get_optional_request -except (SyntaxError, ImportError): - from ._request_builders import build_head_no_params_request # type: ignore - from ._request_builders import build_get_required_request # type: ignore - from ._request_builders import build_put_required_optional_request # type: ignore - from ._request_builders import build_post_parameters_request # type: ignore - from ._request_builders import build_get_optional_request # type: ignore +from ._request_builders import build_head_no_params_request +from ._request_builders import build_get_required_request +from ._request_builders import build_put_required_optional_request +from ._request_builders import build_post_parameters_request +from ._request_builders import build_get_optional_request __all__ = [ "build_head_no_params_request", diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/_request_builders.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/_request_builders.py index 600e40c97d8..ab11c263053 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/_request_builders.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head_no_params_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head_no_params_request(**kwargs: Any) -> HttpRequest: """Head request, no params. Initially has no query parameters. After evolution, a new optional query parameter is added. @@ -42,26 +38,18 @@ def build_head_no_params_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/parameters" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get_required_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_required_request(*, parameter: str, **kwargs: Any) -> HttpRequest: """Get true Boolean value on path. Initially only has one required Query Parameter. After evolution, a new optional query parameter is added. @@ -80,31 +68,23 @@ def build_get_required_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - parameter = kwargs.pop('parameter') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/parameters" # Construct parameters - _params['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') + _params["parameter"] = _SERIALIZER.query("parameter", parameter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_put_required_optional_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, required_param: str, optional_param: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Initially has one required query parameter and one optional query parameter. After evolution, a new optional query parameter is added. @@ -124,35 +104,24 @@ def build_put_required_optional_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - required_param = kwargs.pop('required_param') # type: str - optional_param = kwargs.pop('optional_param', _params.pop('optionalParam', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/parameters" # Construct parameters - _params['requiredParam'] = _SERIALIZER.query("required_param", required_param, 'str') + _params["requiredParam"] = _SERIALIZER.query("required_param", required_param, "str") if optional_param is not None: - _params['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') + _params["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @overload -def build_post_parameters_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_parameters_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """POST a JSON. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -180,10 +149,7 @@ def build_post_parameters_request( @overload -def build_post_parameters_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_parameters_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """POST a JSON. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -202,10 +168,7 @@ def build_post_parameters_request( """ -def build_post_parameters_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_parameters_request(**kwargs: Any) -> HttpRequest: """POST a JSON. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -225,29 +188,21 @@ def build_post_parameters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/parameters" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_get_optional_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_optional_request(*, optional_param: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get true Boolean value on path. Initially has one optional query parameter. After evolution, a new optional query parameter is added. @@ -266,23 +221,16 @@ def build_get_optional_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - optional_param = kwargs.pop('optional_param', _params.pop('optionalParam', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/moreParameters" # Construct parameters if optional_param is not None: - _params['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') + _params["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/_request_builders_py3.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/_request_builders_py3.py deleted file mode 100644 index a865c255ad2..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenInitialLowLevel/dpgservicedriveninitiallowlevel/rest/params/_request_builders_py3.py +++ /dev/null @@ -1,290 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head_no_params_request( - **kwargs: Any -) -> HttpRequest: - """Head request, no params. - Initially has no query parameters. After evolution, a new optional query parameter is added. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/parameters" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_required_request( - *, - parameter: str, - **kwargs: Any -) -> HttpRequest: - """Get true Boolean value on path. - Initially only has one required Query Parameter. After evolution, a new optional query - parameter is added. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword parameter: I am a required parameter. Required. - :paramtype parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/parameters" - - # Construct parameters - _params['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_put_required_optional_request( - *, - required_param: str, - optional_param: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Initially has one required query parameter and one optional query parameter. After evolution, - a new optional query parameter is added. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword required_param: I am a required parameter. Required. - :paramtype required_param: str - :keyword optional_param: I am an optional parameter. Default value is None. - :paramtype optional_param: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/parameters" - - # Construct parameters - _params['requiredParam'] = _SERIALIZER.query("required_param", required_param, 'str') - if optional_param is not None: - _params['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_parameters_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """POST a JSON. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: I am a body parameter. My only valid JSON entry is { url: - "http://example.org/myimage.jpeg" }. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "url": "str" # Required. - } - """ - - -@overload -def build_post_parameters_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """POST a JSON. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: I am a body parameter. My only valid JSON entry is { url: - "http://example.org/myimage.jpeg" }. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_parameters_request( - **kwargs: Any -) -> HttpRequest: - """POST a JSON. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: I am a body parameter. My only valid JSON entry is { url: - "http://example.org/myimage.jpeg" }. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/parameters" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_optional_request( - *, - optional_param: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get true Boolean value on path. - Initially has one optional query parameter. After evolution, a new optional query parameter is - added. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword optional_param: I am an optional parameter. Default value is None. - :paramtype optional_param: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/moreParameters" - - # Construct parameters - if optional_param is not None: - _params['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/_client.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/_client.py index 170339da364..dd27b5e5bed 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/_client.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/_client.py @@ -28,7 +28,6 @@ class DPGClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/__init__.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/__init__.py index 725e075b7c5..1df5a55922b 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/__init__.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/__init__.py @@ -6,22 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head_no_params_request - from ._request_builders_py3 import build_get_required_request - from ._request_builders_py3 import build_put_required_optional_request - from ._request_builders_py3 import build_post_parameters_request - from ._request_builders_py3 import build_delete_parameters_request - from ._request_builders_py3 import build_get_optional_request - from ._request_builders_py3 import build_get_new_operation_request -except (SyntaxError, ImportError): - from ._request_builders import build_head_no_params_request # type: ignore - from ._request_builders import build_get_required_request # type: ignore - from ._request_builders import build_put_required_optional_request # type: ignore - from ._request_builders import build_post_parameters_request # type: ignore - from ._request_builders import build_delete_parameters_request # type: ignore - from ._request_builders import build_get_optional_request # type: ignore - from ._request_builders import build_get_new_operation_request # type: ignore +from ._request_builders import build_head_no_params_request +from ._request_builders import build_get_required_request +from ._request_builders import build_put_required_optional_request +from ._request_builders import build_post_parameters_request +from ._request_builders import build_delete_parameters_request +from ._request_builders import build_get_optional_request +from ._request_builders import build_get_new_operation_request __all__ = [ "build_head_no_params_request", diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/_request_builders.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/_request_builders.py index af97503ef81..20752c11c9f 100644 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/_request_builders.py +++ b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head_no_params_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head_no_params_request(*, new_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Head request, no params. Initially has no query parameters. After evolution, a new optional query parameter is added. @@ -45,32 +41,22 @@ def build_head_no_params_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - new_parameter = kwargs.pop('new_parameter', _params.pop('new_parameter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/parameters" # Construct parameters if new_parameter is not None: - _params['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') + _params["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_required_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_required_request(*, parameter: str, new_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get true Boolean value on path. Initially only has one required Query Parameter. After evolution, a new optional query parameter is added. @@ -91,34 +77,25 @@ def build_get_required_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - parameter = kwargs.pop('parameter') # type: str - new_parameter = kwargs.pop('new_parameter', _params.pop('new_parameter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/parameters" # Construct parameters - _params['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') + _params["parameter"] = _SERIALIZER.query("parameter", parameter, "str") if new_parameter is not None: - _params['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') + _params["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_put_required_optional_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, required_param: str, optional_param: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Initially has one required query parameter and one optional query parameter. After evolution, a new optional query parameter is added. @@ -140,38 +117,26 @@ def build_put_required_optional_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - required_param = kwargs.pop('required_param') # type: str - optional_param = kwargs.pop('optional_param', _params.pop('optionalParam', None)) # type: Optional[str] - new_parameter = kwargs.pop('new_parameter', _params.pop('new_parameter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/parameters" # Construct parameters - _params['requiredParam'] = _SERIALIZER.query("required_param", required_param, 'str') + _params["requiredParam"] = _SERIALIZER.query("required_param", required_param, "str") if optional_param is not None: - _params['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') + _params["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") if new_parameter is not None: - _params['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') + _params["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @overload -def build_post_parameters_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_parameters_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """POST a JSON or a JPEG. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -199,10 +164,7 @@ def build_post_parameters_request( @overload -def build_post_parameters_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_parameters_request(*, content_type: str, content: IO, **kwargs: Any) -> HttpRequest: """POST a JSON or a JPEG. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -221,10 +183,7 @@ def build_post_parameters_request( """ -def build_post_parameters_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_parameters_request(**kwargs: Any) -> HttpRequest: """POST a JSON or a JPEG. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -244,29 +203,21 @@ def build_post_parameters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/parameters" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_delete_parameters_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete_parameters_request(**kwargs: Any) -> HttpRequest: """Delete something. Initially the path exists but there is no delete method. After evolution this is a new method in a known path. @@ -283,17 +234,12 @@ def build_delete_parameters_request( # Construct URL _url = "/serviceDriven/parameters" - return HttpRequest( - method="DELETE", - url=_url, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, **kwargs) def build_get_optional_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, optional_param: Optional[str] = None, new_parameter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Get true Boolean value on path. Initially has one optional query parameter. After evolution, a new optional query parameter is added. @@ -314,35 +260,24 @@ def build_get_optional_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - optional_param = kwargs.pop('optional_param', _params.pop('optionalParam', None)) # type: Optional[str] - new_parameter = kwargs.pop('new_parameter', _params.pop('new_parameter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/moreParameters" # Construct parameters if optional_param is not None: - _params['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') + _params["optionalParam"] = _SERIALIZER.query("optional_param", optional_param, "str") if new_parameter is not None: - _params['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') + _params["new_parameter"] = _SERIALIZER.query("new_parameter", new_parameter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_new_operation_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_new_operation_request(**kwargs: Any) -> HttpRequest: """I'm a new operation. Initiallty neither path or method exist for this operation. After evolution, this is a new method in a new path. @@ -358,17 +293,12 @@ def build_get_new_operation_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/serviceDriven/newPath" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py b/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py deleted file mode 100644 index 45665a5b99a..00000000000 --- a/test/dpg/low-level/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneLowLevel/dpgservicedrivenupdateonelowlevel/rest/params/_request_builders_py3.py +++ /dev/null @@ -1,375 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head_no_params_request( - *, - new_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Head request, no params. Initially has no query parameters. After evolution, a new optional - query parameter is added. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword new_parameter: I'm a new input optional parameter. Default value is None. - :paramtype new_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/parameters" - - # Construct parameters - if new_parameter is not None: - _params['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_required_request( - *, - parameter: str, - new_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get true Boolean value on path. - Initially only has one required Query Parameter. After evolution, a new optional query - parameter is added. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword parameter: I am a required parameter. Required. - :paramtype parameter: str - :keyword new_parameter: I'm a new input optional parameter. Default value is None. - :paramtype new_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/parameters" - - # Construct parameters - _params['parameter'] = _SERIALIZER.query("parameter", parameter, 'str') - if new_parameter is not None: - _params['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_put_required_optional_request( - *, - required_param: str, - optional_param: Optional[str] = None, - new_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Initially has one required query parameter and one optional query parameter. After evolution, - a new optional query parameter is added. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword required_param: I am a required parameter. Required. - :paramtype required_param: str - :keyword optional_param: I am an optional parameter. Default value is None. - :paramtype optional_param: str - :keyword new_parameter: I'm a new input optional parameter. Default value is None. - :paramtype new_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/parameters" - - # Construct parameters - _params['requiredParam'] = _SERIALIZER.query("required_param", required_param, 'str') - if optional_param is not None: - _params['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') - if new_parameter is not None: - _params['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_parameters_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """POST a JSON or a JPEG. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: I am a body parameter with a new content type. My only valid JSON entry is { - url: "http://example.org/myimage.jpeg" }. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "url": "str" # Required. - } - """ - - -@overload -def build_post_parameters_request( - *, - content_type: str, - content: IO, - **kwargs: Any -) -> HttpRequest: - """POST a JSON or a JPEG. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'image/jpeg'. Required. - :paramtype content_type: str - :keyword content: I am a body parameter with a new content type. My only valid JSON entry is { - url: "http://example.org/myimage.jpeg" }. Required. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_parameters_request( - **kwargs: Any -) -> HttpRequest: - """POST a JSON or a JPEG. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: I am a body parameter with a new content type. My only valid JSON entry is { - url: "http://example.org/myimage.jpeg" }. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'image/jpeg'. Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/parameters" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete_parameters_request( - **kwargs: Any -) -> HttpRequest: - """Delete something. - Initially the path exists but there is no delete method. After evolution this is a new method - in a known path. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/serviceDriven/parameters" - - return HttpRequest( - method="DELETE", - url=_url, - **kwargs - ) - - -def build_get_optional_request( - *, - optional_param: Optional[str] = None, - new_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get true Boolean value on path. - Initially has one optional query parameter. After evolution, a new optional query parameter is - added. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword optional_param: I am an optional parameter. Default value is None. - :paramtype optional_param: str - :keyword new_parameter: I'm a new input optional parameter. Default value is None. - :paramtype new_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/moreParameters" - - # Construct parameters - if optional_param is not None: - _params['optionalParam'] = _SERIALIZER.query("optional_param", optional_param, 'str') - if new_parameter is not None: - _params['new_parameter'] = _SERIALIZER.query("new_parameter", new_parameter, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_new_operation_request( - **kwargs: Any -) -> HttpRequest: - """I'm a new operation. - Initiallty neither path or method exist for this operation. After evolution, this is a new - method in a new path. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/serviceDriven/newPath" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py index 535ec09c6cf..8094766136f 100644 --- a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py +++ b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py @@ -31,7 +31,6 @@ class DPGClient(DPGClientOperationsMixin): # pylint: disable=client-accepts-api """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py index 535ec09c6cf..8094766136f 100644 --- a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py +++ b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py @@ -31,7 +31,6 @@ class DPGClient(DPGClientOperationsMixin): # pylint: disable=client-accepts-api """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py index a4d9ddf1612..0bfe9bd9d64 100644 --- a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py +++ b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py @@ -31,7 +31,6 @@ class DPGClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py index 22b8a32b7bc..0ceb312cf1c 100644 --- a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py +++ b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py @@ -31,7 +31,6 @@ class DPGClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py index f97c87b5c66..eda43fd6c8c 100644 --- a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py +++ b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py @@ -28,7 +28,6 @@ class DPGClient(DPGClientOperationsMixin): # pylint: disable=client-accepts-api """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = DPGClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/__init__.py b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/__init__.py index 7e9b159a275..b946f34fe89 100644 --- a/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/__init__.py +++ b/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/__init__.py @@ -10,7 +10,6 @@ from ._models import LROProduct from ._patch import Product - from ._enums import ProductReceived from ._patch import AddedModel diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_configuration.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_configuration.py index 29c2dd5fd8a..a571c8a3286 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -18,8 +18,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class MultiapiServiceClientConfiguration(Configuration): @@ -34,7 +32,7 @@ class MultiapiServiceClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_multiapi_service_client.py index a9035f5a433..644bd0e3e15 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_multiapi_service_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition @@ -21,8 +21,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -68,9 +66,9 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", api_version=None, # type: Optional[str] - base_url="http://localhost:3000", # type: str + base_url: str = "http://localhost:3000", profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py index a5022c5152f..7c4185fc6c0 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py @@ -9,26 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer -from typing import IO, Optional, TYPE_CHECKING, Union +from typing import Any, IO, Iterable, Optional, Union from azure.core.paging import ItemPaged from azure.core.polling import LROPoller from . import models as _models -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable - class MultiapiServiceClientOperationsMixin(object): def begin_test_lro( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -63,11 +58,10 @@ def begin_test_lro( def begin_test_lro_and_paging( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Iterable["_models.Product"]] + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.Product"]]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: Default value is None. @@ -103,12 +97,11 @@ def begin_test_lro_and_paging( def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - greeting_in_chinese=None, # type: Optional[str] - greeting_in_french=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. @@ -141,11 +134,10 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements def test_one( # pylint: disable=inconsistent-return-statements self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """TestOne should be in an FirstVersionOperationsMixin. :param id: An int parameter. Required. @@ -174,9 +166,8 @@ def test_one( # pylint: disable=inconsistent-return-statements def test_paging( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ModelThree"] + **kwargs: Any + ) -> Iterable["_models.ModelThree"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_metadata.json index 3558157e06e..554fdde1087 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/models/__init__.py index a9682db38e2..82d439459f8 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/models/__init__.py @@ -9,7 +9,6 @@ from ._models_py3 import Error from ._models_py3 import PagingResult from ._models_py3 import Product - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py index 13814085427..d5ec3dbf7c9 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json index 647ce355a1a..6bcbecd7835 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -93,7 +93,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"TestOne should be in an FirstVersionOperationsMixin.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -106,7 +106,7 @@ }, "_test_lro_initial" : { "sync": { - "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[_models.Product]\n", + "signature": "def _test_lro_initial(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e Optional[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapi.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product or None or the result of cls(response)\n:rtype: ~multiapi.v1.models.Product or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -119,7 +119,7 @@ }, "begin_test_lro" : { "sync": { - "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[_models.Product]\n", + "signature": "def begin_test_lro(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapi.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~multiapi.v1.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -132,7 +132,7 @@ }, "_test_lro_and_paging_initial" : { "sync": { - "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.PagingResult\n", + "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e _models.PagingResult:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~multiapi.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult or the result of cls(response)\n:rtype: ~multiapi.v1.models.PagingResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -145,7 +145,7 @@ }, "begin_test_lro_and_paging" : { "sync": { - "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[Iterable[\"_models.Product\"]]\n", + "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.Product\"]]:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~multiapi.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult\n or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~multiapi.v1.models.Product]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -158,7 +158,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/models/__init__.py index ea7ff352de4..134ebf1ea8f 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import PagingResult from ._models_py3 import Product from ._models_py3 import TestLroAndPagingOptions - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py index 3d4c333f6a8..2cec5e160d7 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py @@ -28,6 +28,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py index 57af806b390..395686f7feb 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json index 544fda6113c..8f38f6e0850 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.ModelTwo\n", + "signature": "def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e _models.ModelTwo:\n", "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo or the result of cls(response)\n:rtype: ~multiapi.v2.models.ModelTwo\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/models/__init__.py index 7a0e0be99b0..8a114791bc4 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error from ._models_py3 import ModelTwo - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py index 1f5b4b9b207..133cb81f375 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py index a60bce490cf..865314e0c8f 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py index 418e69ee293..b9c2b00a2c4 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( *, parameter_one: bool, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json index 14184f6bf07..5669af5579e 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_paging" : { "sync": { - "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n # type: (...) -\u003e Iterable[\"_models.ModelThree\"]\n", + "signature": "def test_paging(\n self,\n **kwargs: Any\n) -\u003e Iterable[\"_models.ModelThree\"]:\n", "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either ModelThree or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~multiapi.v3.models.ModelThree]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "**kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test. Default value is None.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/models/__init__.py index 14f9853c14a..5fdae05688a 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/models/__init__.py @@ -11,7 +11,6 @@ from ._models_py3 import PagingResult from ._models_py3 import SourcePath - from ._multiapi_service_client_enums import ContentType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py index 75333d20e77..524bea4ca57 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py @@ -26,6 +26,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_paging_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py index 6c40af35d8d..d1739c00aa7 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py index 5aa336d73cd..c0e85364101 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_configuration.py index 0a18a729936..6a08163b9a3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_configuration.py @@ -8,20 +8,15 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any from azure.core.configuration import Configuration +from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - - from azure.core.credentials import AzureKeyCredential - class MultiapiServiceClientConfiguration(Configuration): """Configuration for MultiapiServiceClient. @@ -34,7 +29,7 @@ class MultiapiServiceClientConfiguration(Configuration): def __init__( self, - credential, # type: AzureKeyCredential + credential: AzureKeyCredential, **kwargs # type: Any ): # type: (...) -> None diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_multiapi_service_client.py index 9ef69adab3a..6c6b49af1c8 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_multiapi_service_client.py @@ -9,8 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional +from azure.core.credentials import AzureKeyCredential from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -19,12 +20,6 @@ from ._operations_mixin import MultiapiServiceClientOperationsMixin from ._serialization import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import AzureKeyCredential - class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -68,9 +63,9 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient def __init__( self, - credential, # type: AzureKeyCredential + credential: AzureKeyCredential, api_version=None, # type: Optional[str] - base_url="http://localhost:3000", # type: str + base_url: str = "http://localhost:3000", profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_operations_mixin.py index 3e1099e4b9e..48f57a40c84 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/_operations_mixin.py @@ -9,26 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer -from typing import IO, Optional, TYPE_CHECKING, Union +from typing import Any, IO, Iterable, Optional, Union from azure.core.paging import ItemPaged from azure.core.polling import LROPoller from . import models as _models -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable - class MultiapiServiceClientOperationsMixin(object): def begin_test_lro( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -63,11 +58,10 @@ def begin_test_lro( def begin_test_lro_and_paging( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Iterable["_models.Product"]] + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.Product"]]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: Default value is None. @@ -104,12 +98,11 @@ def begin_test_lro_and_paging( def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - greeting_in_chinese=None, # type: Optional[str] - greeting_in_french=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. @@ -142,11 +135,10 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements def test_one( # pylint: disable=inconsistent-return-statements self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """TestOne should be in an FirstVersionOperationsMixin. :param id: An int parameter. Required. @@ -175,9 +167,8 @@ def test_one( # pylint: disable=inconsistent-return-statements def test_paging( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ModelThree"] + **kwargs: Any + ) -> Iterable["_models.ModelThree"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_metadata.json index 1605c9af193..d155b75566f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: AzureKeyCredential", + "signature": "credential: AzureKeyCredential,", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.AzureKeyCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -93,7 +93,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"TestOne should be in an FirstVersionOperationsMixin.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -106,7 +106,7 @@ }, "_test_lro_initial" : { "sync": { - "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[_models.Product]\n", + "signature": "def _test_lro_initial(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e Optional[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapicredentialdefaultpolicy.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product or None or the result of cls(response)\n:rtype: ~multiapicredentialdefaultpolicy.v1.models.Product or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -119,7 +119,7 @@ }, "begin_test_lro" : { "sync": { - "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[_models.Product]\n", + "signature": "def begin_test_lro(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapicredentialdefaultpolicy.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~multiapicredentialdefaultpolicy.v1.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -132,7 +132,7 @@ }, "_test_lro_and_paging_initial" : { "sync": { - "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.PagingResult\n", + "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e _models.PagingResult:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options:\n ~multiapicredentialdefaultpolicy.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult or the result of cls(response)\n:rtype: ~multiapicredentialdefaultpolicy.v1.models.PagingResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -145,7 +145,7 @@ }, "begin_test_lro_and_paging" : { "sync": { - "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[Iterable[\"_models.Product\"]]\n", + "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.Product\"]]:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options:\n ~multiapicredentialdefaultpolicy.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult\n or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~multiapicredentialdefaultpolicy.v1.models.Product]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -158,7 +158,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/models/__init__.py index ea7ff352de4..134ebf1ea8f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import PagingResult from ._models_py3 import Product from ._models_py3 import TestLroAndPagingOptions - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py index 598ed9f98fc..aca9e4f6fbb 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py @@ -28,6 +28,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py index 2403870c1ef..67064dfad41 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_metadata.json index 97a36ecf6bd..2078f7de23e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: AzureKeyCredential", + "signature": "credential: AzureKeyCredential,", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.AzureKeyCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.ModelTwo\n", + "signature": "def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e _models.ModelTwo:\n", "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo or the result of cls(response)\n:rtype: ~multiapicredentialdefaultpolicy.v2.models.ModelTwo\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/models/__init__.py index 7a0e0be99b0..8a114791bc4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error from ._models_py3 import ModelTwo - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py index e7eaec89c4d..1f2a64b90dc 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py index 11c9b0435a3..adebdcfe806 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py index 73e21e76572..f4d15cb6211 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( *, parameter_one: bool, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_metadata.json index 72058f690ee..bcf93203c3d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: AzureKeyCredential", + "signature": "credential: AzureKeyCredential,", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.AzureKeyCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_paging" : { "sync": { - "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n # type: (...) -\u003e Iterable[\"_models.ModelThree\"]\n", + "signature": "def test_paging(\n self,\n **kwargs: Any\n) -\u003e Iterable[\"_models.ModelThree\"]:\n", "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either ModelThree or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~multiapicredentialdefaultpolicy.v3.models.ModelThree]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "**kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test. Default value is None.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/models/__init__.py index 14f9853c14a..5fdae05688a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/models/__init__.py @@ -11,7 +11,6 @@ from ._models_py3 import PagingResult from ._models_py3 import SourcePath - from ._multiapi_service_client_enums import ContentType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py index 622f029f491..1a9b4975f98 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py @@ -26,6 +26,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_paging_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py index 14176562cbd..813b4c5a104 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py index 02748040720..d7eaf53cef4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_configuration.py index ee49c2ea3a9..efe68acc20b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -17,8 +17,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): @@ -35,8 +33,8 @@ class MultiapiCustomBaseUrlServiceClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - endpoint, # type: str + credential: "TokenCredential", + endpoint: str, **kwargs # type: Any ): # type: (...) -> None diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_multiapi_custom_base_url_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_multiapi_custom_base_url_service_client.py index 6fb752afeb6..7c694f98cb3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_multiapi_custom_base_url_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_multiapi_custom_base_url_service_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core import PipelineClient from azure.profiles import KnownProfiles, ProfileDefinition @@ -21,8 +21,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -64,8 +62,8 @@ class MultiapiCustomBaseUrlServiceClient(MultiapiCustomBaseUrlServiceClientOpera def __init__( self, - credential, # type: "TokenCredential" - endpoint, # type: str + credential: "TokenCredential", + endpoint: str, api_version=None, # type: Optional[str] profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_operations_mixin.py index 8d9757f5201..e172ae6e311 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/_operations_mixin.py @@ -9,23 +9,18 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer -from typing import TYPE_CHECKING +from typing import Any from . import models as _models -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - class MultiapiCustomBaseUrlServiceClientOperationsMixin(object): def test( # pylint: disable=inconsistent-return-statements self, - id, # type: int - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + **kwargs: Any + ) -> None: """Should be a mixin operation. Put in 2 for the required parameter and have the correct api version of 2.0.0 to pass. diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_metadata.json index 68a89ef2e83..c002a0ed53d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/_metadata.json @@ -16,13 +16,13 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "endpoint": { - "signature": "endpoint, # type: str", + "signature": "endpoint: str,", "description": "Pass in https://localhost:3000. Required.", "docstring_type": "str", "required": true @@ -92,7 +92,7 @@ "operations": { "test" : { "sync": { - "signature": "def test( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Should be a mixin operation. Put in 1 for the required parameter and have the correct api\nversion of 1.0.0 to pass.\n\n:param id: An int parameter. Put in 1 to pass. Required.\n:type id: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/models/__init__.py index eea3cc7a9d8..0b7cd153702 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py index f2e5598843b..e3122294e47 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_metadata.json index 9e52fad2e82..d0bacc39a1f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/_metadata.json @@ -16,13 +16,13 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "endpoint": { - "signature": "endpoint, # type: str", + "signature": "endpoint: str,", "description": "Pass in https://localhost:3000. Required.", "docstring_type": "str", "required": true @@ -92,7 +92,7 @@ "operations": { "test" : { "sync": { - "signature": "def test( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Should be a mixin operation. Put in 2 for the required parameter and have the correct api\nversion of 2.0.0 to pass.\n\n:param id: An int parameter. Put in 2 to pass. Required.\n:type id: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/models/__init__.py index eea3cc7a9d8..0b7cd153702 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py index 68da2742154..f788c536668 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_configuration.py index 1a78b884f75..cfc4c1ff9ee 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -17,8 +17,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class MultiapiServiceClientConfiguration(Configuration): @@ -33,7 +31,7 @@ class MultiapiServiceClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_multiapi_service_client.py index 8c48d58973e..3eb376c7517 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_multiapi_service_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core import PipelineClient from azure.profiles import KnownProfiles, ProfileDefinition @@ -21,8 +21,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -68,9 +66,9 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", api_version=None, # type: Optional[str] - base_url="http://localhost:3000", # type: str + base_url: str = "http://localhost:3000", profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_operations_mixin.py index 1237d09baeb..0b1249f1c72 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/_operations_mixin.py @@ -9,26 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer -from typing import IO, Optional, TYPE_CHECKING, Union +from typing import Any, IO, Iterable, Optional, Union from azure.core.paging import ItemPaged from azure.core.polling import LROPoller from . import models as _models -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable - class MultiapiServiceClientOperationsMixin(object): def begin_test_lro( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -63,11 +58,10 @@ def begin_test_lro( def begin_test_lro_and_paging( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Iterable["_models.Product"]] + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.Product"]]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: Default value is None. @@ -103,12 +97,11 @@ def begin_test_lro_and_paging( def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - greeting_in_chinese=None, # type: Optional[str] - greeting_in_french=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. @@ -141,11 +134,10 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements def test_one( # pylint: disable=inconsistent-return-statements self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """TestOne should be in an FirstVersionOperationsMixin. :param id: An int parameter. Required. @@ -174,9 +166,8 @@ def test_one( # pylint: disable=inconsistent-return-statements def test_paging( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ModelThree"] + **kwargs: Any + ) -> Iterable["_models.ModelThree"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_metadata.json index 9a1363a20ad..bd51a2338bb 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -93,7 +93,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"TestOne should be in an FirstVersionOperationsMixin.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -106,7 +106,7 @@ }, "_test_lro_initial" : { "sync": { - "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[_models.Product]\n", + "signature": "def _test_lro_initial(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e Optional[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapidataplane.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product or None or the result of cls(response)\n:rtype: ~multiapidataplane.v1.models.Product or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -119,7 +119,7 @@ }, "begin_test_lro" : { "sync": { - "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[_models.Product]\n", + "signature": "def begin_test_lro(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapidataplane.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~multiapidataplane.v1.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -132,7 +132,7 @@ }, "_test_lro_and_paging_initial" : { "sync": { - "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.PagingResult\n", + "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e _models.PagingResult:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~multiapidataplane.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult or the result of cls(response)\n:rtype: ~multiapidataplane.v1.models.PagingResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -145,7 +145,7 @@ }, "begin_test_lro_and_paging" : { "sync": { - "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[Iterable[\"_models.Product\"]]\n", + "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.Product\"]]:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~multiapidataplane.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult\n or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~multiapidataplane.v1.models.Product]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -158,7 +158,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/models/__init__.py index ea7ff352de4..134ebf1ea8f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import PagingResult from ._models_py3 import Product from ._models_py3 import TestLroAndPagingOptions - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py index 6e3483d4c18..ea7443571c1 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py @@ -27,6 +27,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py index bac074f4a2e..bc90c3a1090 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_metadata.json index f9860246535..8d7647fe5f5 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.ModelTwo\n", + "signature": "def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e _models.ModelTwo:\n", "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo or the result of cls(response)\n:rtype: ~multiapidataplane.v2.models.ModelTwo\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/models/__init__.py index 7a0e0be99b0..8a114791bc4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error from ._models_py3 import ModelTwo - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py index 55cab10df2c..b1172e4f458 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py index 02644b05f99..a53dabd1dd9 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py index 224c5ca5bfa..020df6f51b1 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( *, parameter_one: bool, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_metadata.json index 2c2038a9e33..1e652c5ea19 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_paging" : { "sync": { - "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n # type: (...) -\u003e Iterable[\"_models.ModelThree\"]\n", + "signature": "def test_paging(\n self,\n **kwargs: Any\n) -\u003e Iterable[\"_models.ModelThree\"]:\n", "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either ModelThree or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~multiapidataplane.v3.models.ModelThree]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "**kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test. Default value is None.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/models/__init__.py index 14f9853c14a..5fdae05688a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/models/__init__.py @@ -11,7 +11,6 @@ from ._models_py3 import PagingResult from ._models_py3 import SourcePath - from ._multiapi_service_client_enums import ContentType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py index 573ad73dc76..49d484db54d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_paging_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py index 1e2ccf6cf14..9e74f5d5546 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py index d8b6ff6e2de..951b8d4e13f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_configuration.py index 83a0c5198e5..bbeb336b29f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -18,8 +18,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class MultiapiServiceClientConfiguration(Configuration): @@ -34,7 +32,7 @@ class MultiapiServiceClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_multiapi_service_client.py index 2977896d613..6f8322422a1 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_multiapi_service_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition @@ -21,8 +21,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -68,9 +66,9 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", api_version=None, # type: Optional[str] - base_url="http://localhost:3000", # type: str + base_url: str = "http://localhost:3000", profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py index b7e168113e4..f463f05715c 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py @@ -9,26 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer -from typing import IO, Optional, TYPE_CHECKING, Union +from typing import Any, IO, Iterable, Optional, Union from azure.core.paging import ItemPaged from azure.core.polling import LROPoller from . import models as _models -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable - class MultiapiServiceClientOperationsMixin(object): def begin_test_lro( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -63,11 +58,10 @@ def begin_test_lro( def begin_test_lro_and_paging( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Iterable["_models.Product"]] + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.Product"]]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: Default value is None. @@ -103,12 +97,11 @@ def begin_test_lro_and_paging( def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - greeting_in_chinese=None, # type: Optional[str] - greeting_in_french=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. @@ -141,11 +134,10 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements def test_one( # pylint: disable=inconsistent-return-statements self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """TestOne should be in an FirstVersionOperationsMixin. :param id: An int parameter. Required. @@ -174,9 +166,8 @@ def test_one( # pylint: disable=inconsistent-return-statements def test_paging( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ModelThree"] + **kwargs: Any + ) -> Iterable["_models.ModelThree"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json index 0ad2ddaf7cf..2d0ec19708b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -93,7 +93,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"TestOne should be in an FirstVersionOperationsMixin.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -106,7 +106,7 @@ }, "_test_lro_initial" : { "sync": { - "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[_models.Product]\n", + "signature": "def _test_lro_initial(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e Optional[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapinoasync.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product or None or the result of cls(response)\n:rtype: ~multiapinoasync.v1.models.Product or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -119,7 +119,7 @@ }, "begin_test_lro" : { "sync": { - "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[_models.Product]\n", + "signature": "def begin_test_lro(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapinoasync.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~multiapinoasync.v1.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -132,7 +132,7 @@ }, "_test_lro_and_paging_initial" : { "sync": { - "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.PagingResult\n", + "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e _models.PagingResult:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~multiapinoasync.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult or the result of cls(response)\n:rtype: ~multiapinoasync.v1.models.PagingResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -145,7 +145,7 @@ }, "begin_test_lro_and_paging" : { "sync": { - "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[Iterable[\"_models.Product\"]]\n", + "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.Product\"]]:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~multiapinoasync.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult\n or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~multiapinoasync.v1.models.Product]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -158,7 +158,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/models/__init__.py index ea7ff352de4..134ebf1ea8f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import PagingResult from ._models_py3 import Product from ._models_py3 import TestLroAndPagingOptions - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py index 835f71ebe8a..f50c6ad08d5 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py @@ -28,6 +28,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py index 784bf738c00..eb9d95e4e9e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json index 65e38bce56f..60567870c52 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.ModelTwo\n", + "signature": "def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e _models.ModelTwo:\n", "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo or the result of cls(response)\n:rtype: ~multiapinoasync.v2.models.ModelTwo\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/models/__init__.py index 7a0e0be99b0..8a114791bc4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error from ._models_py3 import ModelTwo - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py index 7167b5a384b..c8725297812 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py index b9be73fd7b7..ee98f66835a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py index d61edf7b089..a203115ac3a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( *, parameter_one: bool, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json index aa3f18e009f..75ceaf184e9 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_paging" : { "sync": { - "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n # type: (...) -\u003e Iterable[\"_models.ModelThree\"]\n", + "signature": "def test_paging(\n self,\n **kwargs: Any\n) -\u003e Iterable[\"_models.ModelThree\"]:\n", "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either ModelThree or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~multiapinoasync.v3.models.ModelThree]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "**kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test. Default value is None.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/models/__init__.py index 14f9853c14a..5fdae05688a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/models/__init__.py @@ -11,7 +11,6 @@ from ._models_py3 import PagingResult from ._models_py3 import SourcePath - from ._multiapi_service_client_enums import ContentType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py index 1f8f95605d6..aa5b3941fd4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py @@ -26,6 +26,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_paging_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py index a2952752294..611a4b969c3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py index 11dd52083b1..72dea106236 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_configuration.py index 9c50b33ca0d..af046cbc3c7 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -17,8 +17,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class MultiapiServiceClientConfiguration(Configuration): @@ -33,7 +31,7 @@ class MultiapiServiceClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_multiapi_service_client.py index ea8346647f1..b6cb6061381 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_multiapi_service_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core import PipelineClient from azure.profiles import KnownProfiles, ProfileDefinition @@ -21,8 +21,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -65,9 +63,9 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", api_version=None, # type: Optional[str] - base_url="http://localhost:3000", # type: str + base_url: str = "http://localhost:3000", profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_operations_mixin.py index 829f6c21122..efe95f32769 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/_operations_mixin.py @@ -9,26 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer -from typing import IO, Optional, TYPE_CHECKING, Union +from typing import Any, IO, Iterable, Optional, Union from azure.core.paging import ItemPaged from azure.core.polling import LROPoller from . import models as _models -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable - class MultiapiServiceClientOperationsMixin(object): def begin_test_lro( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -63,11 +58,10 @@ def begin_test_lro( def begin_test_lro_and_paging( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Iterable["_models.Product"]] + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.Product"]]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: Default value is None. @@ -103,10 +97,9 @@ def begin_test_lro_and_paging( def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. @@ -131,11 +124,10 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements def test_one( # pylint: disable=inconsistent-return-statements self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """TestOne should be in an FirstVersionOperationsMixin. :param id: An int parameter. Required. diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/_metadata.json index a2caa821482..aed9368f47f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/models/__init__.py index a9682db38e2..82d439459f8 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/models/__init__.py @@ -9,7 +9,6 @@ from ._models_py3 import Error from ._models_py3 import PagingResult from ._models_py3 import Product - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py index 15fa11ed1de..4493575114f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/_metadata.json index 495bf26d92c..e3f892cc5cf 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -93,7 +93,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"TestOne should be in an FirstVersionOperationsMixin.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -106,7 +106,7 @@ }, "_test_lro_initial" : { "sync": { - "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[_models.Product]\n", + "signature": "def _test_lro_initial(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e Optional[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapisecurity.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product or None or the result of cls(response)\n:rtype: ~multiapisecurity.v1.models.Product or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -119,7 +119,7 @@ }, "begin_test_lro" : { "sync": { - "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[_models.Product]\n", + "signature": "def begin_test_lro(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapisecurity.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~multiapisecurity.v1.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -132,7 +132,7 @@ }, "_test_lro_and_paging_initial" : { "sync": { - "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.PagingResult\n", + "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e _models.PagingResult:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~multiapisecurity.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult or the result of cls(response)\n:rtype: ~multiapisecurity.v1.models.PagingResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -145,7 +145,7 @@ }, "begin_test_lro_and_paging" : { "sync": { - "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[Iterable[\"_models.Product\"]]\n", + "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.Product\"]]:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options: ~multiapisecurity.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult\n or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~multiapisecurity.v1.models.Product]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -158,7 +158,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/models/__init__.py index ea7ff352de4..134ebf1ea8f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import PagingResult from ._models_py3 import Product from ._models_py3 import TestLroAndPagingOptions - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py index cf9c0fa32db..35c977981a1 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py @@ -27,6 +27,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py index 7cb88619d11..a0af8b782c3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py @@ -24,6 +24,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_configuration.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_configuration.py index e74acb109b8..90fee1d8048 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_configuration.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -18,8 +18,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential class MultiapiServiceClientConfiguration(Configuration): @@ -34,7 +32,7 @@ class MultiapiServiceClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", **kwargs # type: Any ): # type: (...) -> None diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_multiapi_service_client.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_multiapi_service_client.py index 8fba1e6bb9f..72ef9315735 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_multiapi_service_client.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_multiapi_service_client.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition @@ -21,8 +21,6 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential class _SDKClient(object): @@ -68,9 +66,9 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient def __init__( self, - credential, # type: "TokenCredential" + credential: "TokenCredential", api_version=None, # type: Optional[str] - base_url="http://localhost:3000", # type: str + base_url: str = "http://localhost:3000", profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py index 3de6e1478da..c4efb9f40e4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py @@ -9,26 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- from ._serialization import Serializer, Deserializer -from typing import IO, Optional, TYPE_CHECKING, Union +from typing import Any, IO, Iterable, Optional, Union from azure.core.paging import ItemPaged from azure.core.polling import LROPoller from . import models as _models -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Iterable - class MultiapiServiceClientOperationsMixin(object): def begin_test_lro( self, - product=None, # type: Optional[Union[_models.Product, IO]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[_models.Product] + product: Optional[Union[_models.Product, IO]] = None, + **kwargs: Any + ) -> LROPoller[_models.Product]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. Is either a model type or a IO type. Default value is None. @@ -63,11 +58,10 @@ def begin_test_lro( def begin_test_lro_and_paging( self, - client_request_id=None, # type: Optional[str] - test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Iterable["_models.Product"]] + client_request_id: Optional[str] = None, + test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, + **kwargs: Any + ) -> LROPoller[Iterable["_models.Product"]]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: Default value is None. @@ -104,12 +98,11 @@ def begin_test_lro_and_paging( def test_different_calls( # pylint: disable=inconsistent-return-statements self, - greeting_in_english, # type: str - greeting_in_chinese=None, # type: Optional[str] - greeting_in_french=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + greeting_in_english: str, + greeting_in_chinese: Optional[str] = None, + greeting_in_french: Optional[str] = None, + **kwargs: Any + ) -> None: """Has added parameters across the API versions. :param greeting_in_english: pass in 'hello' to pass test. Required. @@ -142,11 +135,10 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements def test_one( # pylint: disable=inconsistent-return-statements self, - id, # type: int - message=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + id: int, + message: Optional[str] = None, + **kwargs: Any + ) -> None: """TestOne should be in an FirstVersionOperationsMixin. :param id: An int parameter. Required. @@ -175,9 +167,8 @@ def test_one( # pylint: disable=inconsistent-return-statements def test_paging( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ModelThree"] + **kwargs: Any + ) -> Iterable["_models.ModelThree"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json index 0854e8cd58b..2511bae83ed 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -93,7 +93,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_one( # pylint: disable=inconsistent-return-statements\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"TestOne should be in an FirstVersionOperationsMixin.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -106,7 +106,7 @@ }, "_test_lro_initial" : { "sync": { - "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[_models.Product]\n", + "signature": "def _test_lro_initial(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e Optional[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapiwithsubmodule.submodule.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product or None or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v1.models.Product or None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -119,7 +119,7 @@ }, "begin_test_lro" : { "sync": { - "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[Union[_models.Product, IO]]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[_models.Product]\n", + "signature": "def begin_test_lro(\n self,\n product: Optional[Union[_models.Product, IO]] = None,\n **kwargs: Any\n) -\u003e LROPoller[_models.Product]:\n", "doc": "\"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put. Is either a model type or a IO type. Default value is None.\n:type product: ~multiapiwithsubmodule.submodule.v1.models.Product or IO\n:keyword content_type: Body Parameter content-type. Known values are: \u0027application/json\u0027.\n Default value is None.\n:paramtype content_type: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either Product or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[~multiapiwithsubmodule.submodule.v1.models.Product]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "product, **kwargs" }, @@ -132,7 +132,7 @@ }, "_test_lro_and_paging_initial" : { "sync": { - "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.PagingResult\n", + "signature": "def _test_lro_and_paging_initial(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e _models.PagingResult:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options:\n ~multiapiwithsubmodule.submodule.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v1.models.PagingResult\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -145,7 +145,7 @@ }, "begin_test_lro_and_paging" : { "sync": { - "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id=None, # type: Optional[str]\n test_lro_and_paging_options=None, # type: Optional[_models.TestLroAndPagingOptions]\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[Iterable[\"_models.Product\"]]\n", + "signature": "def begin_test_lro_and_paging(\n self,\n client_request_id: Optional[str] = None,\n test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,\n **kwargs: Any\n) -\u003e LROPoller[Iterable[\"_models.Product\"]]:\n", "doc": "\"\"\"A long-running paging operation that includes a nextLink that has 10 pages.\n\n:param client_request_id: Default value is None.\n:type client_request_id: str\n:param test_lro_and_paging_options: Parameter group. Default value is None.\n:type test_lro_and_paging_options:\n ~multiapiwithsubmodule.submodule.v1.models.TestLroAndPagingOptions\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns an iterator like instance of either PagingResult\n or the result of cls(response)\n:rtype:\n ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~multiapiwithsubmodule.submodule.v1.models.Product]]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "client_request_id, test_lro_and_paging_options, **kwargs" }, @@ -158,7 +158,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/models/__init__.py index ea7ff352de4..134ebf1ea8f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import PagingResult from ._models_py3 import Product from ._models_py3 import TestLroAndPagingOptions - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py index f8e1c192c9d..1588561bcbb 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py @@ -28,6 +28,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py index 7bb244298f9..32926290534 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json index 325a093da66..32af974f1b5 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_one" : { "sync": { - "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e _models.ModelTwo\n", + "signature": "def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs: Any\n) -\u003e _models.ModelTwo:\n", "doc": "\"\"\"TestOne should be in an SecondVersionOperationsMixin. Returns ModelTwo.\n\n:param id: An int parameter. Required.\n:type id: int\n:param message: An optional string parameter. Default value is None.\n:type message: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: ModelTwo or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v2.models.ModelTwo\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "id, message, **kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/models/__init__.py index 7a0e0be99b0..8a114791bc4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error from ._models_py3 import ModelTwo - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py index 29bac3b0083..974e77f2a4f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_one_request( *, id: int, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py index feade7c9879..2f417247ee7 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py index 59fe39ae17c..e8326770b6b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( *, parameter_one: bool, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json index 79d934d67ab..ef4e44f71e6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json @@ -16,7 +16,7 @@ "global_parameters": { "sync": { "credential": { - "signature": "credential, # type: \"TokenCredential\"", + "signature": "credential: \"TokenCredential\",", "description": "Credential needed for the client to connect to Azure. Required.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=\"http://localhost:3000\", # type: str", + "signature": "base_url: str = \"http://localhost:3000\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -94,7 +94,7 @@ "operations": { "test_paging" : { "sync": { - "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n # type: (...) -\u003e Iterable[\"_models.ModelThree\"]\n", + "signature": "def test_paging(\n self,\n **kwargs: Any\n) -\u003e Iterable[\"_models.ModelThree\"]:\n", "doc": "\"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either ModelThree or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~multiapiwithsubmodule.submodule.v3.models.ModelThree]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "**kwargs" }, @@ -107,7 +107,7 @@ }, "test_different_calls" : { "sync": { - "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english, # type: str\n greeting_in_chinese=None, # type: Optional[str]\n greeting_in_french=None, # type: Optional[str]\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def test_different_calls( # pylint: disable=inconsistent-return-statements\n self,\n greeting_in_english: str,\n greeting_in_chinese: Optional[str] = None,\n greeting_in_french: Optional[str] = None,\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Has added parameters across the API versions.\n\n:param greeting_in_english: pass in \u0027hello\u0027 to pass test. Required.\n:type greeting_in_english: str\n:param greeting_in_chinese: pass in \u0027nihao\u0027 to pass test. Default value is None.\n:type greeting_in_chinese: str\n:param greeting_in_french: pass in \u0027bonjour\u0027 to pass test. Default value is None.\n:type greeting_in_french: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None or the result of cls(response)\n:rtype: None\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"", "call": "greeting_in_english, greeting_in_chinese, greeting_in_french, **kwargs" }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/models/__init__.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/models/__init__.py index 14f9853c14a..5fdae05688a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/models/__init__.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/models/__init__.py @@ -11,7 +11,6 @@ from ._models_py3 import PagingResult from ._models_py3 import SourcePath - from ._multiapi_service_client_enums import ContentType from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py index eb213e2835c..da5348cdb1d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py @@ -26,6 +26,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_paging_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py index 3a7e4baed79..2ecb390e536 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_two_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py index 249b056e571..9ec985e44d8 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py @@ -25,6 +25,7 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False + def build_test_four_request( **kwargs: Any ) -> HttpRequest: diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/__init__.py index 125c1999aa1..03924893010 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/__init__.py @@ -13,7 +13,6 @@ from ._models_py3 import PetAPObject from ._models_py3 import PetAPString from ._models_py3 import PetAPTrue - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/__init__.py index c73d75669cd..8613fef599f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/__init__.py @@ -9,7 +9,6 @@ from ._models_py3 import Error from ._models_py3 import Product - from ._auto_rest_swagger_bat_array_service_enums import Enum0 from ._auto_rest_swagger_bat_array_service_enums import Enum1 from ._auto_rest_swagger_bat_array_service_enums import FooEnum diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/__init__.py index c73d75669cd..8613fef599f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/__init__.py @@ -9,7 +9,6 @@ from ._models_py3 import Error from ._models_py3 import Product - from ._auto_rest_swagger_bat_array_service_enums import Enum0 from ._auto_rest_swagger_bat_array_service_enums import Enum1 from ._auto_rest_swagger_bat_array_service_enums import FooEnum diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py index c73d75669cd..8613fef599f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py @@ -9,7 +9,6 @@ from ._models_py3 import Error from ._models_py3 import Product - from ._auto_rest_swagger_bat_array_service_enums import Enum0 from ._auto_rest_swagger_bat_array_service_enums import Enum1 from ._auto_rest_swagger_bat_array_service_enums import FooEnum diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/__init__.py index 2a090c77ddb..84d7c9ee89a 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/__init__.py @@ -39,7 +39,6 @@ from ._models_py3 import SmartSalmon from ._models_py3 import StringWrapper - from ._auto_rest_complex_test_service_enums import CMYKColors from ._auto_rest_complex_test_service_enums import GoblinSharkColor from ._auto_rest_complex_test_service_enums import MyKind diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/__init__.py index 652545c847f..28ff96e2aa9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error from ._models_py3 import Widget - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/__init__.py index 80f06459760..75cb47e3f2d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/__init__.py @@ -9,7 +9,6 @@ from ._models_py3 import Error from ._models_py3 import Paths1MqqetpFormdataStreamUploadfilePostRequestbodyContentMultipartFormDataSchema from ._models_py3 import Paths1P3Stk3FormdataStreamUploadfilesPostRequestbodyContentMultipartFormDataSchema - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py index 67aa021e49f..cd52c49ad4f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/__init__.py @@ -13,7 +13,6 @@ PathsPvivzlFormsdataurlencodedPartialconstantbodyPostRequestbodyContentApplicationXWwwFormUrlencodedSchema, ) - from ._body_forms_data_url_encoded_enums import PetFood from ._body_forms_data_url_encoded_enums import PetType from ._patch import __all__ as _patch_all diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/__init__.py index bc3bd753f25..26cc5dde039 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/__init__.py @@ -9,7 +9,6 @@ from ._models_py3 import Error from ._models_py3 import RefColorConstant - from ._auto_rest_swagger_bat_service_enums import Colors from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/__init__.py index 1276505cad9..68619918d9f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/__init__.py @@ -23,7 +23,6 @@ from ._models_py3 import NoModelAsStringRequiredTwoValueDefault from ._models_py3 import NoModelAsStringRequiredTwoValueNoDefault - from ._auto_rest_swagger_constant_service_enums import ModelAsStringNoRequiredOneValueDefaultEnum from ._auto_rest_swagger_constant_service_enums import ModelAsStringNoRequiredOneValueDefaultOpEnum from ._auto_rest_swagger_constant_service_enums import ModelAsStringNoRequiredOneValueNoDefaultEnum diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/__init__.py index f03dbbdc62d..bd9f65d9f18 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/__init__.py @@ -11,7 +11,6 @@ from ._models_py3 import InnerError from ._models_py3 import SecretResponse - from ._error_with_secrets_enums import ErrorCode from ._error_with_secrets_enums import InnerErrorCode from ._patch import __all__ as _patch_all diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/__init__.py index 376c3aff31e..f7970651b56 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Pet - from ._pet_store_inc_enums import DaysOfWeekExtensibleEnum from ._pet_store_inc_enums import IntEnum from ._patch import __all__ as _patch_all diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/__init__.py index cb6607ad354..907556c81f8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error - from ._auto_rest_swagger_bat_header_service_enums import GreyscaleColors from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/__init__.py index 721a13718ef..4c78f4d5f56 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/__init__.py @@ -11,7 +11,6 @@ from ._models_py3 import D from ._models_py3 import Error from ._models_py3 import MyException - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py index 25571e61668..5e519f8e61f 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import SourcePath - from ._media_types_client_enums import ContentType from ._media_types_client_enums import ContentType1 from ._media_types_client_enums import ContentType2 diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/__init__.py index e0eeec13646..a78503d84b5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/__init__.py @@ -18,7 +18,6 @@ from ._models_py3 import SimpleProduct from ._models_py3 import WrappedProduct - from ._auto_rest_resource_flattening_test_service_enums import FlattenedProductPropertiesProvisioningStateValues from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py index c3a445d2aeb..dfab3918ccc 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py @@ -12,7 +12,6 @@ from ._models_py3 import Horse from ._models_py3 import Kitten from ._models_py3 import Pet - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/__init__.py index b99e3ac8ea7..74f6d4292a8 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/__init__.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- - from ._non_string_enums_client_enums import FloatEnum from ._non_string_enums_client_enums import IntEnum from ._patch import __all__ as _patch_all diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py index 40a8c408f98..f0908b136fe 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py @@ -7,9 +7,10 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core import PipelineClient +from azure.core.rest import HttpRequest, HttpResponse from ._configuration import AnythingClientConfiguration from ._serialization import Deserializer, Serializer @@ -17,9 +18,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Dict - - from azure.core.rest import HttpRequest, HttpResponse + from typing import Dict class AnythingClient(AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword @@ -30,12 +29,7 @@ class AnythingClient(AnythingClientOperationsMixin): # pylint: disable=client-a :type base_url: str """ - def __init__( - self, - base_url="http://localhost:3000", # type: str - **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: self._config = AnythingClientConfiguration(**kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) @@ -44,12 +38,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - def _send_request( - self, - request, # type: HttpRequest - **kwargs # type: Any - ): - # type: (...) -> HttpResponse + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_configuration.py index bc617d7bb81..74b3896a438 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_configuration.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_configuration.py @@ -6,17 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any from azure.core.configuration import Configuration from azure.core.pipeline import policies from ._version import VERSION -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any - class AnythingClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AnythingClient. @@ -25,10 +21,7 @@ class AnythingClientConfiguration(Configuration): # pylint: disable=too-many-in attributes. """ - def __init__( - self, **kwargs # type: Any - ): - # type: (...) -> None + def __init__(self, **kwargs: Any) -> None: super(AnythingClientConfiguration, self).__init__(**kwargs) kwargs.setdefault("sdk_moniker", "packagemode/{}".format(VERSION)) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_vendor.py index 0dafe0e287f..c6b76567398 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_vendor.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_vendor.py @@ -5,8 +5,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from abc import ABC +from typing import TYPE_CHECKING + from azure.core.pipeline.transport import HttpRequest +from ._configuration import AnythingClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import PipelineClient + + from ._serialization import Deserializer, Serializer + def _convert_request(request, files=None): data = request.content if not files else None @@ -14,3 +25,12 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: AnythingClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_vendor.py new file mode 100644 index 00000000000..ff9fe2bb5a2 --- /dev/null +++ b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from azure.core.pipeline.transport import HttpRequest + +from ._configuration import AnythingClientConfiguration + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core import AsyncPipelineClient + + from .._serialization import Deserializer, Serializer + + +class MixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: AnythingClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py index 25801e12311..5246a048f4d 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py @@ -30,12 +30,13 @@ build_put_object_request, build_put_string_request, ) +from .._vendor import MixinABC T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class AnythingClientOperationsMixin: +class AnythingClientOperationsMixin(MixinABC): @distributed_trace_async async def get_object(self, **kwargs: Any) -> Any: """Basic get that returns an object as anything. Returns object { 'message': 'An object was diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py index a86f63dbc3d..7d85fa365f9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Optional, TYPE_CHECKING +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -22,157 +22,102 @@ from azure.core.utils import case_insensitive_dict from .._serialization import Serializer -from .._vendor import _convert_request +from .._vendor import MixinABC, _convert_request -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Optional, TypeVar - - T = TypeVar("T") - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_object_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + +def build_get_object_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/anything/object") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_object_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_object_request(*, json: Any, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = kwargs.pop("template_url", "/anything/object") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/anything/string") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_request(*, json: Any, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = kwargs.pop("template_url", "/anything/string") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/anything/array") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_array_request(*, json: Any, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = kwargs.pop("template_url", "/anything/array") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) -# fmt: on -class AnythingClientOperationsMixin(object): +class AnythingClientOperationsMixin(MixinABC): @distributed_trace - def get_object( - self, **kwargs # type: Any - ): - # type: (...) -> Any + def get_object(self, **kwargs: Any) -> Any: """Basic get that returns an object as anything. Returns object { 'message': 'An object was successfully returned' }. @@ -217,12 +162,7 @@ def get_object( get_object.metadata = {"url": "/anything/object"} # type: ignore @distributed_trace - def put_object( # pylint: disable=inconsistent-return-statements - self, - input, # type: Any - **kwargs # type: Any - ): - # type: (...) -> None + def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Basic put that puts an object as anything. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -270,10 +210,7 @@ def put_object( # pylint: disable=inconsistent-return-statements put_object.metadata = {"url": "/anything/object"} # type: ignore @distributed_trace - def get_string( - self, **kwargs # type: Any - ): - # type: (...) -> Any + def get_string(self, **kwargs: Any) -> Any: """Basic get that returns an string as anything. Returns string 'foo'. :keyword callable cls: A custom type or function that will be passed the direct response @@ -317,12 +254,7 @@ def get_string( get_string.metadata = {"url": "/anything/string"} # type: ignore @distributed_trace - def put_string( # pylint: disable=inconsistent-return-statements - self, - input, # type: Any - **kwargs # type: Any - ): - # type: (...) -> None + def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Basic put that puts an string as anything. Pass in 'anything' to get a 200 and anything else to get an object error. @@ -370,10 +302,7 @@ def put_string( # pylint: disable=inconsistent-return-statements put_string.metadata = {"url": "/anything/string"} # type: ignore @distributed_trace - def get_array( - self, **kwargs # type: Any - ): - # type: (...) -> Any + def get_array(self, **kwargs: Any) -> Any: """Basic get that returns an array as anything. Returns string ['foo', 'bar']. :keyword callable cls: A custom type or function that will be passed the direct response @@ -417,12 +346,7 @@ def get_array( get_array.metadata = {"url": "/anything/array"} # type: ignore @distributed_trace - def put_array( # pylint: disable=inconsistent-return-statements - self, - input, # type: Any - **kwargs # type: Any - ): - # type: (...) -> None + def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Basic put that puts an array as anything. Pass in ['foo', 'bar'] to get a 200 and anything else to get an object error. diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/__init__.py index e171c974fc0..7ab7ab31166 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import AvailabilitySetUpdateParameters - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/__init__.py index 766646570d8..90f12ce8ae9 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/__init__.py @@ -16,7 +16,6 @@ from ._models_py3 import Product from ._models_py3 import StringOptionalWrapper from ._models_py3 import StringWrapper - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/__init__.py index 7cfe9f2788c..e0f99ffbb48 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import PathsJaneoqReservedwordsOperationDataPutRequestbodyContentApplicationXWwwFormUrlencodedSchema from ._models_py3 import PathsU1PxjnReservedwordsOperationFilesPutRequestbodyContentMultipartFormDataSchema - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/__init__.py index 92cc3baf985..f3a8ba29409 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/__init__.py @@ -8,7 +8,6 @@ from ._models_py3 import Error - from ._auto_rest_url_test_service_enums import UriColor from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/__init__.py index 0b55578dad8..925b67c63d5 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._models_py3 import Error - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/__init__.py index e9720eae831..f771628cba0 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/__init__.py @@ -10,7 +10,6 @@ from ._models_py3 import ConstantProduct from ._models_py3 import Error from ._models_py3 import Product - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py index 550f5fd765d..ec1fcf0beb2 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py @@ -36,7 +36,6 @@ from ._models_py3 import Slideshow from ._models_py3 import StorageServiceProperties - from ._auto_rest_swagger_batxml_service_enums import AccessTier from ._auto_rest_swagger_batxml_service_enums import ArchiveStatus from ._auto_rest_swagger_batxml_service_enums import BlobType diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/__init__.py index f2c40c7d67d..864c2f9dd46 100644 --- a/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/__init__.py +++ b/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/__init__.py @@ -16,7 +16,6 @@ from ._models_py3 import PetActionError from ._models_py3 import PetHungryOrThirstyError from ._models_py3 import PetSadError - from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_client.py index 06e6d8a9084..86eabf99cf9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/_client.py @@ -28,7 +28,6 @@ class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AdditionalPropertiesClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/__init__.py index 65128f19617..9edd05fa4d2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/__init__.py @@ -6,20 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_create_ap_true_request - from ._request_builders_py3 import build_create_cat_ap_true_request - from ._request_builders_py3 import build_create_ap_object_request - from ._request_builders_py3 import build_create_ap_string_request - from ._request_builders_py3 import build_create_ap_in_properties_request - from ._request_builders_py3 import build_create_ap_in_properties_with_ap_string_request -except (SyntaxError, ImportError): - from ._request_builders import build_create_ap_true_request # type: ignore - from ._request_builders import build_create_cat_ap_true_request # type: ignore - from ._request_builders import build_create_ap_object_request # type: ignore - from ._request_builders import build_create_ap_string_request # type: ignore - from ._request_builders import build_create_ap_in_properties_request # type: ignore - from ._request_builders import build_create_ap_in_properties_with_ap_string_request # type: ignore +from ._request_builders import build_create_ap_true_request +from ._request_builders import build_create_cat_ap_true_request +from ._request_builders import build_create_ap_object_request +from ._request_builders import build_create_ap_string_request +from ._request_builders import build_create_ap_in_properties_request +from ._request_builders import build_create_ap_in_properties_with_ap_string_request __all__ = [ "build_create_ap_true_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py index 29daa5b0f30..2444bcbf062 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders.py @@ -22,13 +22,9 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload -def build_create_ap_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_true_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -57,10 +53,7 @@ def build_create_ap_true_request( @overload -def build_create_ap_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_true_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -78,10 +71,7 @@ def build_create_ap_true_request( """ -def build_create_ap_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_true_request(**kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,30 +90,22 @@ def build_create_ap_true_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/additionalProperties/true" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload -def build_create_cat_ap_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_cat_ap_true_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Create a CatAPTrue which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -153,10 +135,7 @@ def build_create_cat_ap_true_request( @overload -def build_create_cat_ap_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_cat_ap_true_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Create a CatAPTrue which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -174,10 +153,7 @@ def build_create_cat_ap_true_request( """ -def build_create_cat_ap_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_cat_ap_true_request(**kwargs: Any) -> HttpRequest: """Create a CatAPTrue which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -196,30 +172,22 @@ def build_create_cat_ap_true_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/additionalProperties/true-subclass" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload -def build_create_ap_object_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_object_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -248,10 +216,7 @@ def build_create_ap_object_request( @overload -def build_create_ap_object_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_object_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -269,10 +234,7 @@ def build_create_ap_object_request( """ -def build_create_ap_object_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_object_request(**kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -291,30 +253,22 @@ def build_create_ap_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/additionalProperties/type/object" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload -def build_create_ap_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_string_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -343,10 +297,7 @@ def build_create_ap_string_request( @overload -def build_create_ap_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_string_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -364,10 +315,7 @@ def build_create_ap_string_request( """ -def build_create_ap_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_string_request(**kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -386,30 +334,24 @@ def build_create_ap_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/additionalProperties/type/string" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_create_ap_in_properties_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -439,9 +381,8 @@ def build_create_ap_in_properties_request( @overload def build_create_ap_in_properties_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -459,10 +400,7 @@ def build_create_ap_in_properties_request( """ -def build_create_ap_in_properties_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_in_properties_request(**kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -481,30 +419,24 @@ def build_create_ap_in_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/additionalProperties/in/properties" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_create_ap_in_properties_with_ap_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -538,9 +470,8 @@ def build_create_ap_in_properties_with_ap_string_request( @overload def build_create_ap_in_properties_with_ap_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -558,10 +489,7 @@ def build_create_ap_in_properties_with_ap_string_request( """ -def build_create_ap_in_properties_with_ap_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_ap_in_properties_with_ap_string_request(**kwargs: Any) -> HttpRequest: """Create a Pet which contains more properties than what is defined. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -580,20 +508,15 @@ def build_create_ap_in_properties_with_ap_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/additionalProperties/in/properties/with/additionalProperties/string" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py deleted file mode 100644 index d8a0b6ed5bc..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AdditionalPropertiesLowLevel/additionalpropertieslowlevel/rest/pets/_request_builders_py3.py +++ /dev/null @@ -1,617 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_create_ap_true_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": 0, # Required. - "name": "str", # Optional. - "status": bool # Optional. - } - """ - - -@overload -def build_create_ap_true_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_create_ap_true_request( - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/additionalProperties/true" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_create_cat_ap_true_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a CatAPTrue which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "friendly": bool, # Optional. - "id": 0, # Required. - "name": "str", # Optional. - "status": bool # Optional. - } - """ - - -@overload -def build_create_cat_ap_true_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a CatAPTrue which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_create_cat_ap_true_request( - **kwargs: Any -) -> HttpRequest: - """Create a CatAPTrue which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/additionalProperties/true-subclass" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_create_ap_object_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": 0, # Required. - "name": "str", # Optional. - "status": bool # Optional. - } - """ - - -@overload -def build_create_ap_object_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_create_ap_object_request( - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/additionalProperties/type/object" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_create_ap_string_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": 0, # Required. - "name": "str", # Optional. - "status": bool # Optional. - } - """ - - -@overload -def build_create_ap_string_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_create_ap_string_request( - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/additionalProperties/type/string" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_create_ap_in_properties_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": 0, # Required. - "name": "str", # Optional. - "status": bool # Optional. - } - """ - - -@overload -def build_create_ap_in_properties_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_create_ap_in_properties_request( - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/additionalProperties/in/properties" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_create_ap_in_properties_with_ap_string_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "@odata.location": "str", # Required. - "additionalProperties": { - "str": 0.0 # Optional. Dictionary of :code:``. - }, - "id": 0, # Required. - "name": "str", # Optional. - "status": bool # Optional. - } - """ - - -@overload -def build_create_ap_in_properties_with_ap_string_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_create_ap_in_properties_with_ap_string_request( - **kwargs: Any -) -> HttpRequest: - """Create a Pet which contains more properties than what is defined. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/additionalProperties/in/properties/with/additionalProperties/string" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_client.py index eba6b2a355b..3b58f2cb53e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/_client.py @@ -29,7 +29,6 @@ class AnythingClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AnythingClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/__init__.py index cc874f11a17..8bbae510df2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/__init__.py @@ -6,20 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_object_request - from ._request_builders_py3 import build_put_object_request - from ._request_builders_py3 import build_get_string_request - from ._request_builders_py3 import build_put_string_request - from ._request_builders_py3 import build_get_array_request - from ._request_builders_py3 import build_put_array_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_object_request # type: ignore - from ._request_builders import build_put_object_request # type: ignore - from ._request_builders import build_get_string_request # type: ignore - from ._request_builders import build_put_string_request # type: ignore - from ._request_builders import build_get_array_request # type: ignore - from ._request_builders import build_put_array_request # type: ignore +from ._request_builders import build_get_object_request +from ._request_builders import build_put_object_request +from ._request_builders import build_get_string_request +from ._request_builders import build_put_string_request +from ._request_builders import build_get_array_request +from ._request_builders import build_put_array_request __all__ = [ "build_get_object_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py index 3e65d0fa907..884bad222b3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_object_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_object_request(**kwargs: Any) -> HttpRequest: """Basic get that returns an object as anything. Returns object { 'message': 'An object was successfully returned' }. @@ -35,26 +31,18 @@ def build_get_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/anything/object" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_object_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_object_request(*, json: Any, **kwargs: Any) -> HttpRequest: """Basic put that puts an object as anything. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -71,26 +59,18 @@ def build_put_object_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/anything/object" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_request(**kwargs: Any) -> HttpRequest: """Basic get that returns an string as anything. Returns string 'foo'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -104,26 +84,18 @@ def build_get_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/anything/string" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_request(*, json: Any, **kwargs: Any) -> HttpRequest: """Basic put that puts an string as anything. Pass in 'anything' to get a 200 and anything else to get an object error. @@ -140,26 +112,18 @@ def build_put_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/anything/string" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_request(**kwargs: Any) -> HttpRequest: """Basic get that returns an array as anything. Returns string ['foo', 'bar']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -173,26 +137,18 @@ def build_get_array_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/anything/array" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_array_request(*, json: Any, **kwargs: Any) -> HttpRequest: """Basic put that puts an array as anything. Pass in ['foo', 'bar'] to get a 200 and anything else to get an object error. @@ -209,17 +165,12 @@ def build_put_array_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/anything/array" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 2509b80f2cc..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/AnythingLowLevel/anythinglowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,228 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_object_request( - **kwargs: Any -) -> HttpRequest: - """Basic get that returns an object as anything. Returns object { 'message': 'An object was - successfully returned' }. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/anything/object" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_object_request( - *, - json: Any, - **kwargs: Any -) -> HttpRequest: - """Basic put that puts an object as anything. Pass in {'foo': 'bar'} to get a 200 and anything - else to get an object error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Pass in {'foo': 'bar'} for a 200, anything else for an object error. Required. - :paramtype json: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/anything/object" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_string_request( - **kwargs: Any -) -> HttpRequest: - """Basic get that returns an string as anything. Returns string 'foo'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/anything/string" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_string_request( - *, - json: Any, - **kwargs: Any -) -> HttpRequest: - """Basic put that puts an string as anything. Pass in 'anything' to get a 200 and anything else to - get an object error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Pass in 'anything' for a 200, anything else for an object error. Required. - :paramtype json: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/anything/string" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_array_request( - **kwargs: Any -) -> HttpRequest: - """Basic get that returns an array as anything. Returns string ['foo', 'bar']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/anything/array" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_array_request( - *, - json: Any, - **kwargs: Any -) -> HttpRequest: - """Basic put that puts an array as anything. Pass in ['foo', 'bar'] to get a 200 and anything else - to get an object error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Pass in ['foo', 'bar'] for a 200, anything else for an object error. Required. - :paramtype json: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/anything/array" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_client.py index 6f79df82ad3..35c176d06f7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-vers """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/__init__.py index a715b62d9ae..4a41f8f3fc8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/__init__.py @@ -6,146 +6,75 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_invalid_request - from ._request_builders_py3 import build_get_empty_request - from ._request_builders_py3 import build_put_empty_request - from ._request_builders_py3 import build_get_boolean_tfft_request - from ._request_builders_py3 import build_put_boolean_tfft_request - from ._request_builders_py3 import build_get_boolean_invalid_null_request - from ._request_builders_py3 import build_get_boolean_invalid_string_request - from ._request_builders_py3 import build_get_integer_valid_request - from ._request_builders_py3 import build_put_integer_valid_request - from ._request_builders_py3 import build_get_int_invalid_null_request - from ._request_builders_py3 import build_get_int_invalid_string_request - from ._request_builders_py3 import build_get_long_valid_request - from ._request_builders_py3 import build_put_long_valid_request - from ._request_builders_py3 import build_get_long_invalid_null_request - from ._request_builders_py3 import build_get_long_invalid_string_request - from ._request_builders_py3 import build_get_float_valid_request - from ._request_builders_py3 import build_put_float_valid_request - from ._request_builders_py3 import build_get_float_invalid_null_request - from ._request_builders_py3 import build_get_float_invalid_string_request - from ._request_builders_py3 import build_get_double_valid_request - from ._request_builders_py3 import build_put_double_valid_request - from ._request_builders_py3 import build_get_double_invalid_null_request - from ._request_builders_py3 import build_get_double_invalid_string_request - from ._request_builders_py3 import build_get_string_valid_request - from ._request_builders_py3 import build_put_string_valid_request - from ._request_builders_py3 import build_get_enum_valid_request - from ._request_builders_py3 import build_put_enum_valid_request - from ._request_builders_py3 import build_get_string_enum_valid_request - from ._request_builders_py3 import build_put_string_enum_valid_request - from ._request_builders_py3 import build_get_string_with_null_request - from ._request_builders_py3 import build_get_string_with_invalid_request - from ._request_builders_py3 import build_get_uuid_valid_request - from ._request_builders_py3 import build_put_uuid_valid_request - from ._request_builders_py3 import build_get_uuid_invalid_chars_request - from ._request_builders_py3 import build_get_date_valid_request - from ._request_builders_py3 import build_put_date_valid_request - from ._request_builders_py3 import build_get_date_invalid_null_request - from ._request_builders_py3 import build_get_date_invalid_chars_request - from ._request_builders_py3 import build_get_date_time_valid_request - from ._request_builders_py3 import build_put_date_time_valid_request - from ._request_builders_py3 import build_get_date_time_invalid_null_request - from ._request_builders_py3 import build_get_date_time_invalid_chars_request - from ._request_builders_py3 import build_get_date_time_rfc1123_valid_request - from ._request_builders_py3 import build_put_date_time_rfc1123_valid_request - from ._request_builders_py3 import build_get_duration_valid_request - from ._request_builders_py3 import build_put_duration_valid_request - from ._request_builders_py3 import build_get_byte_valid_request - from ._request_builders_py3 import build_put_byte_valid_request - from ._request_builders_py3 import build_get_byte_invalid_null_request - from ._request_builders_py3 import build_get_base64_url_request - from ._request_builders_py3 import build_get_complex_null_request - from ._request_builders_py3 import build_get_complex_empty_request - from ._request_builders_py3 import build_get_complex_item_null_request - from ._request_builders_py3 import build_get_complex_item_empty_request - from ._request_builders_py3 import build_get_complex_valid_request - from ._request_builders_py3 import build_put_complex_valid_request - from ._request_builders_py3 import build_get_array_null_request - from ._request_builders_py3 import build_get_array_empty_request - from ._request_builders_py3 import build_get_array_item_null_request - from ._request_builders_py3 import build_get_array_item_empty_request - from ._request_builders_py3 import build_get_array_valid_request - from ._request_builders_py3 import build_put_array_valid_request - from ._request_builders_py3 import build_get_dictionary_null_request - from ._request_builders_py3 import build_get_dictionary_empty_request - from ._request_builders_py3 import build_get_dictionary_item_null_request - from ._request_builders_py3 import build_get_dictionary_item_empty_request - from ._request_builders_py3 import build_get_dictionary_valid_request - from ._request_builders_py3 import build_put_dictionary_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore - from ._request_builders import build_get_empty_request # type: ignore - from ._request_builders import build_put_empty_request # type: ignore - from ._request_builders import build_get_boolean_tfft_request # type: ignore - from ._request_builders import build_put_boolean_tfft_request # type: ignore - from ._request_builders import build_get_boolean_invalid_null_request # type: ignore - from ._request_builders import build_get_boolean_invalid_string_request # type: ignore - from ._request_builders import build_get_integer_valid_request # type: ignore - from ._request_builders import build_put_integer_valid_request # type: ignore - from ._request_builders import build_get_int_invalid_null_request # type: ignore - from ._request_builders import build_get_int_invalid_string_request # type: ignore - from ._request_builders import build_get_long_valid_request # type: ignore - from ._request_builders import build_put_long_valid_request # type: ignore - from ._request_builders import build_get_long_invalid_null_request # type: ignore - from ._request_builders import build_get_long_invalid_string_request # type: ignore - from ._request_builders import build_get_float_valid_request # type: ignore - from ._request_builders import build_put_float_valid_request # type: ignore - from ._request_builders import build_get_float_invalid_null_request # type: ignore - from ._request_builders import build_get_float_invalid_string_request # type: ignore - from ._request_builders import build_get_double_valid_request # type: ignore - from ._request_builders import build_put_double_valid_request # type: ignore - from ._request_builders import build_get_double_invalid_null_request # type: ignore - from ._request_builders import build_get_double_invalid_string_request # type: ignore - from ._request_builders import build_get_string_valid_request # type: ignore - from ._request_builders import build_put_string_valid_request # type: ignore - from ._request_builders import build_get_enum_valid_request # type: ignore - from ._request_builders import build_put_enum_valid_request # type: ignore - from ._request_builders import build_get_string_enum_valid_request # type: ignore - from ._request_builders import build_put_string_enum_valid_request # type: ignore - from ._request_builders import build_get_string_with_null_request # type: ignore - from ._request_builders import build_get_string_with_invalid_request # type: ignore - from ._request_builders import build_get_uuid_valid_request # type: ignore - from ._request_builders import build_put_uuid_valid_request # type: ignore - from ._request_builders import build_get_uuid_invalid_chars_request # type: ignore - from ._request_builders import build_get_date_valid_request # type: ignore - from ._request_builders import build_put_date_valid_request # type: ignore - from ._request_builders import build_get_date_invalid_null_request # type: ignore - from ._request_builders import build_get_date_invalid_chars_request # type: ignore - from ._request_builders import build_get_date_time_valid_request # type: ignore - from ._request_builders import build_put_date_time_valid_request # type: ignore - from ._request_builders import build_get_date_time_invalid_null_request # type: ignore - from ._request_builders import build_get_date_time_invalid_chars_request # type: ignore - from ._request_builders import build_get_date_time_rfc1123_valid_request # type: ignore - from ._request_builders import build_put_date_time_rfc1123_valid_request # type: ignore - from ._request_builders import build_get_duration_valid_request # type: ignore - from ._request_builders import build_put_duration_valid_request # type: ignore - from ._request_builders import build_get_byte_valid_request # type: ignore - from ._request_builders import build_put_byte_valid_request # type: ignore - from ._request_builders import build_get_byte_invalid_null_request # type: ignore - from ._request_builders import build_get_base64_url_request # type: ignore - from ._request_builders import build_get_complex_null_request # type: ignore - from ._request_builders import build_get_complex_empty_request # type: ignore - from ._request_builders import build_get_complex_item_null_request # type: ignore - from ._request_builders import build_get_complex_item_empty_request # type: ignore - from ._request_builders import build_get_complex_valid_request # type: ignore - from ._request_builders import build_put_complex_valid_request # type: ignore - from ._request_builders import build_get_array_null_request # type: ignore - from ._request_builders import build_get_array_empty_request # type: ignore - from ._request_builders import build_get_array_item_null_request # type: ignore - from ._request_builders import build_get_array_item_empty_request # type: ignore - from ._request_builders import build_get_array_valid_request # type: ignore - from ._request_builders import build_put_array_valid_request # type: ignore - from ._request_builders import build_get_dictionary_null_request # type: ignore - from ._request_builders import build_get_dictionary_empty_request # type: ignore - from ._request_builders import build_get_dictionary_item_null_request # type: ignore - from ._request_builders import build_get_dictionary_item_empty_request # type: ignore - from ._request_builders import build_get_dictionary_valid_request # type: ignore - from ._request_builders import build_put_dictionary_valid_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_get_invalid_request +from ._request_builders import build_get_empty_request +from ._request_builders import build_put_empty_request +from ._request_builders import build_get_boolean_tfft_request +from ._request_builders import build_put_boolean_tfft_request +from ._request_builders import build_get_boolean_invalid_null_request +from ._request_builders import build_get_boolean_invalid_string_request +from ._request_builders import build_get_integer_valid_request +from ._request_builders import build_put_integer_valid_request +from ._request_builders import build_get_int_invalid_null_request +from ._request_builders import build_get_int_invalid_string_request +from ._request_builders import build_get_long_valid_request +from ._request_builders import build_put_long_valid_request +from ._request_builders import build_get_long_invalid_null_request +from ._request_builders import build_get_long_invalid_string_request +from ._request_builders import build_get_float_valid_request +from ._request_builders import build_put_float_valid_request +from ._request_builders import build_get_float_invalid_null_request +from ._request_builders import build_get_float_invalid_string_request +from ._request_builders import build_get_double_valid_request +from ._request_builders import build_put_double_valid_request +from ._request_builders import build_get_double_invalid_null_request +from ._request_builders import build_get_double_invalid_string_request +from ._request_builders import build_get_string_valid_request +from ._request_builders import build_put_string_valid_request +from ._request_builders import build_get_enum_valid_request +from ._request_builders import build_put_enum_valid_request +from ._request_builders import build_get_string_enum_valid_request +from ._request_builders import build_put_string_enum_valid_request +from ._request_builders import build_get_string_with_null_request +from ._request_builders import build_get_string_with_invalid_request +from ._request_builders import build_get_uuid_valid_request +from ._request_builders import build_put_uuid_valid_request +from ._request_builders import build_get_uuid_invalid_chars_request +from ._request_builders import build_get_date_valid_request +from ._request_builders import build_put_date_valid_request +from ._request_builders import build_get_date_invalid_null_request +from ._request_builders import build_get_date_invalid_chars_request +from ._request_builders import build_get_date_time_valid_request +from ._request_builders import build_put_date_time_valid_request +from ._request_builders import build_get_date_time_invalid_null_request +from ._request_builders import build_get_date_time_invalid_chars_request +from ._request_builders import build_get_date_time_rfc1123_valid_request +from ._request_builders import build_put_date_time_rfc1123_valid_request +from ._request_builders import build_get_duration_valid_request +from ._request_builders import build_put_duration_valid_request +from ._request_builders import build_get_byte_valid_request +from ._request_builders import build_put_byte_valid_request +from ._request_builders import build_get_byte_invalid_null_request +from ._request_builders import build_get_base64_url_request +from ._request_builders import build_get_complex_null_request +from ._request_builders import build_get_complex_empty_request +from ._request_builders import build_get_complex_item_null_request +from ._request_builders import build_get_complex_item_empty_request +from ._request_builders import build_get_complex_valid_request +from ._request_builders import build_put_complex_valid_request +from ._request_builders import build_get_array_null_request +from ._request_builders import build_get_array_empty_request +from ._request_builders import build_get_array_item_null_request +from ._request_builders import build_get_array_item_empty_request +from ._request_builders import build_get_array_valid_request +from ._request_builders import build_put_array_valid_request +from ._request_builders import build_get_dictionary_null_request +from ._request_builders import build_get_dictionary_empty_request +from ._request_builders import build_get_dictionary_item_null_request +from ._request_builders import build_get_dictionary_item_empty_request +from ._request_builders import build_get_dictionary_valid_request +from ._request_builders import build_put_dictionary_valid_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py index 03f00b74f91..8400304fbaa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders.py @@ -23,12 +23,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null array value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -42,26 +38,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get invalid array [1, 2, 3. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -75,26 +63,18 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get empty array value []. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -108,27 +88,19 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(*, json: List[str], content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value empty []. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -155,10 +127,7 @@ def build_put_empty_request( @overload -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value empty []. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -176,10 +145,7 @@ def build_put_empty_request( """ -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(**kwargs: Any) -> HttpRequest: """Set array value empty []. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -198,29 +164,21 @@ def build_put_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/empty" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_boolean_tfft_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: """Get boolean array value [true, false, false, true]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -234,27 +192,21 @@ def build_get_boolean_tfft_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/boolean/tfft" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_boolean_tfft_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[bool], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value empty [true, false, false, true]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -281,10 +233,7 @@ def build_put_boolean_tfft_request( @overload -def build_put_boolean_tfft_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_boolean_tfft_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value empty [true, false, false, true]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -302,10 +251,7 @@ def build_put_boolean_tfft_request( """ -def build_put_boolean_tfft_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_boolean_tfft_request(**kwargs: Any) -> HttpRequest: """Set array value empty [true, false, false, true]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -324,29 +270,21 @@ def build_put_boolean_tfft_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/boolean/tfft" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_boolean_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get boolean array value [true, null, false]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -360,26 +298,18 @@ def build_get_boolean_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/boolean/true.null.false" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_boolean_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get boolean array value [true, 'boolean', false]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -393,26 +323,18 @@ def build_get_boolean_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/boolean/true.boolean.false" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_integer_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: """Get integer array value [1, -1, 3, 300]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -426,27 +348,21 @@ def build_get_integer_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/integer/1.-1.3.300" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_integer_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[int], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -473,10 +389,7 @@ def build_put_integer_valid_request( @overload -def build_put_integer_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_integer_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -494,10 +407,7 @@ def build_put_integer_valid_request( """ -def build_put_integer_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_integer_valid_request(**kwargs: Any) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -516,29 +426,21 @@ def build_put_integer_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/integer/1.-1.3.300" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_int_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get integer array value [1, null, 0]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -552,26 +454,18 @@ def build_get_int_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/integer/1.null.zero" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_int_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get integer array value [1, 'integer', 0]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -585,26 +479,18 @@ def build_get_int_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/integer/1.integer.0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_long_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: """Get integer array value [1, -1, 3, 300]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -618,27 +504,19 @@ def build_get_long_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/long/1.-1.3.300" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_long_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_long_valid_request(*, json: List[int], content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -665,10 +543,7 @@ def build_put_long_valid_request( @overload -def build_put_long_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_long_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -686,10 +561,7 @@ def build_put_long_valid_request( """ -def build_put_long_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_long_valid_request(**kwargs: Any) -> HttpRequest: """Set array value empty [1, -1, 3, 300]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -708,29 +580,21 @@ def build_put_long_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/long/1.-1.3.300" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_long_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get long array value [1, null, 0]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -744,26 +608,18 @@ def build_get_long_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/long/1.null.zero" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_long_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get long array value [1, 'integer', 0]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -777,26 +633,18 @@ def build_get_long_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/long/1.integer.0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_float_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: """Get float array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -810,27 +658,21 @@ def build_get_float_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/float/0--0.01-1.2e20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_float_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[float], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -857,10 +699,7 @@ def build_put_float_valid_request( @overload -def build_put_float_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_float_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -878,10 +717,7 @@ def build_put_float_valid_request( """ -def build_put_float_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_float_valid_request(**kwargs: Any) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -900,29 +736,21 @@ def build_put_float_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/float/0--0.01-1.2e20" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_float_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get float array value [0.0, null, -1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -936,26 +764,18 @@ def build_get_float_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/float/0.0-null-1.2e20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_float_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get boolean array value [1.0, 'number', 0.0]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -969,26 +789,18 @@ def build_get_float_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/float/1.number.0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_double_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: """Get float array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1002,27 +814,21 @@ def build_get_double_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/double/0--0.01-1.2e20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_double_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[float], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1049,10 +855,7 @@ def build_put_double_valid_request( @overload -def build_put_double_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_double_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1070,10 +873,7 @@ def build_put_double_valid_request( """ -def build_put_double_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_double_valid_request(**kwargs: Any) -> HttpRequest: """Set array value [0, -0.01, 1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1092,29 +892,21 @@ def build_put_double_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/double/0--0.01-1.2e20" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_double_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get float array value [0.0, null, -1.2e20]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1128,26 +920,18 @@ def build_get_double_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/double/0.0-null-1.2e20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_double_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get boolean array value [1.0, 'number', 0.0]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1161,26 +945,18 @@ def build_get_double_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/double/1.number.0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_string_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: """Get string array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1194,27 +970,21 @@ def build_get_string_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/string/foo1.foo2.foo3" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_string_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[str], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1241,10 +1011,7 @@ def build_put_string_valid_request( @overload -def build_put_string_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1262,10 +1029,7 @@ def build_put_string_valid_request( """ -def build_put_string_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_valid_request(**kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1284,29 +1048,21 @@ def build_put_string_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/string/foo1.foo2.foo3" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_enum_valid_request(**kwargs: Any) -> HttpRequest: """Get enum array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1320,27 +1076,19 @@ def build_get_enum_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/enum/foo1.foo2.foo3" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_enum_valid_request(*, json: List[str], content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1367,10 +1115,7 @@ def build_put_enum_valid_request( @overload -def build_put_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_enum_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1388,10 +1133,7 @@ def build_put_enum_valid_request( """ -def build_put_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_enum_valid_request(**kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1410,29 +1152,21 @@ def build_put_enum_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/enum/foo1.foo2.foo3" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_string_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: """Get enum array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1446,27 +1180,21 @@ def build_get_string_enum_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/string-enum/foo1.foo2.foo3" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_string_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[str], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1494,9 +1222,8 @@ def build_put_string_enum_valid_request( @overload def build_put_string_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1514,10 +1241,7 @@ def build_put_string_enum_valid_request( """ -def build_put_string_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_enum_valid_request(**kwargs: Any) -> HttpRequest: """Set array value ['foo1', 'foo2', 'foo3']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1536,29 +1260,21 @@ def build_put_string_enum_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/string-enum/foo1.foo2.foo3" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_string_with_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: """Get string array value ['foo', null, 'foo2']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1572,26 +1288,18 @@ def build_get_string_with_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/string/foo.null.foo2" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_string_with_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: """Get string array value ['foo', 123, 'foo2']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1605,26 +1313,18 @@ def build_get_string_with_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/string/foo.123.foo2" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_uuid_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1639,27 +1339,19 @@ def build_get_uuid_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/uuid/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_uuid_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_uuid_valid_request(*, json: List[str], content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1687,10 +1379,7 @@ def build_put_uuid_valid_request( @overload -def build_put_uuid_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_uuid_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1709,10 +1398,7 @@ def build_put_uuid_valid_request( """ -def build_put_uuid_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_uuid_valid_request(**kwargs: Any) -> HttpRequest: """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. @@ -1732,29 +1418,21 @@ def build_put_uuid_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/uuid/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_uuid_invalid_chars_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_uuid_invalid_chars_request(**kwargs: Any) -> HttpRequest: """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1768,26 +1446,18 @@ def build_get_uuid_invalid_chars_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/uuid/invalidchars" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1801,27 +1471,21 @@ def build_get_date_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[datetime.date], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1848,10 +1512,7 @@ def build_put_date_valid_request( @overload -def build_put_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1869,10 +1530,7 @@ def build_put_date_valid_request( """ -def build_put_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_valid_request(**kwargs: Any) -> HttpRequest: """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1891,29 +1549,21 @@ def build_put_date_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_date_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get date array value ['2012-01-01', null, '1776-07-04']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1927,26 +1577,18 @@ def build_get_date_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date/invalidnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_invalid_chars_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: """Get date array value ['2011-03-22', 'date']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1960,26 +1602,18 @@ def build_get_date_invalid_chars_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date/invalidchars" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -1994,27 +1628,21 @@ def build_get_date_time_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date-time/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[datetime.datetime], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -2042,10 +1670,7 @@ def build_put_date_time_valid_request( @overload -def build_put_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -2064,10 +1689,7 @@ def build_put_date_time_valid_request( """ -def build_put_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_valid_request(**kwargs: Any) -> HttpRequest: """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. @@ -2087,29 +1709,21 @@ def build_put_date_time_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date-time/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_date_time_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get date array value ['2000-12-01t00:00:01z', null]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2123,26 +1737,18 @@ def build_get_date_time_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date-time/invalidnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_time_invalid_chars_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: """Get date array value ['2000-12-01t00:00:01z', 'date-time']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2156,26 +1762,18 @@ def build_get_date_time_invalid_chars_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date-time/invalidchars" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_time_rfc1123_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2190,27 +1788,21 @@ def build_get_date_time_rfc1123_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date-time-rfc1123/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_date_time_rfc1123_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[datetime.datetime], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2239,9 +1831,8 @@ def build_put_date_time_rfc1123_valid_request( @overload def build_put_date_time_rfc1123_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2260,10 +1851,7 @@ def build_put_date_time_rfc1123_valid_request( """ -def build_put_date_time_rfc1123_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 Oct 1492 10:15:01 GMT']. @@ -2283,29 +1871,21 @@ def build_put_date_time_rfc1123_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/date-time-rfc1123/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_duration_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2319,27 +1899,21 @@ def build_get_duration_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/duration/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_duration_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[datetime.timedelta], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2366,10 +1940,7 @@ def build_put_duration_valid_request( @overload -def build_put_duration_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_duration_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2387,10 +1958,7 @@ def build_put_duration_valid_request( """ -def build_put_duration_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_duration_valid_request(**kwargs: Any) -> HttpRequest: """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2409,29 +1977,21 @@ def build_put_duration_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/duration/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_byte_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded in base64. @@ -2446,27 +2006,21 @@ def build_get_byte_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/byte/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_byte_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[bytes], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -2494,10 +2048,7 @@ def build_put_byte_valid_request( @overload -def build_put_byte_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_byte_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -2516,10 +2067,7 @@ def build_put_byte_valid_request( """ -def build_put_byte_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_byte_valid_request(**kwargs: Any) -> HttpRequest: """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each elementencoded in base 64. @@ -2539,29 +2087,21 @@ def build_put_byte_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/byte/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_byte_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2575,26 +2115,18 @@ def build_get_byte_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/byte/invalidnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_base64_url_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with the items base64url encoded. @@ -2609,26 +2141,18 @@ def build_get_base64_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/prim/base64url/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: """Get array of complex type null value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2642,26 +2166,18 @@ def build_get_complex_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/complex/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: """Get empty array of complex type []. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2675,26 +2191,18 @@ def build_get_complex_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/complex/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_item_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, 'string': '6'}]. @@ -2709,26 +2217,18 @@ def build_get_complex_item_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/complex/itemnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_item_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, 'string': '6'}]. @@ -2743,26 +2243,18 @@ def build_get_complex_item_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/complex/itemempty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2777,27 +2269,21 @@ def build_get_complex_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/complex/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_complex_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[JSON], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2828,10 +2314,7 @@ def build_put_complex_valid_request( @overload -def build_put_complex_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complex_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2850,10 +2333,7 @@ def build_put_complex_valid_request( """ -def build_put_complex_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complex_valid_request(**kwargs: Any) -> HttpRequest: """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, {'integer': 5, 'string': '6'}]. @@ -2873,29 +2353,21 @@ def build_put_complex_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/complex/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_array_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_null_request(**kwargs: Any) -> HttpRequest: """Get a null array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2909,26 +2381,18 @@ def build_get_array_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/array/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_array_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: """Get an empty array []. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2942,26 +2406,18 @@ def build_get_array_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/array/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_array_item_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2975,26 +2431,18 @@ def build_get_array_item_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/array/itemnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_array_item_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -3008,26 +2456,18 @@ def build_get_array_item_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/array/itemempty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_array_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -3041,27 +2481,21 @@ def build_get_array_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/array/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_array_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[List[str]], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -3090,10 +2524,7 @@ def build_put_array_valid_request( @overload -def build_put_array_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_array_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -3111,10 +2542,7 @@ def build_put_array_valid_request( """ -def build_put_array_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_array_valid_request(**kwargs: Any) -> HttpRequest: """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -3133,29 +2561,21 @@ def build_put_array_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/array/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: """Get an array of Dictionaries with value null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -3169,26 +2589,18 @@ def build_get_dictionary_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/dictionary/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: """Get an array of Dictionaries of type with value []. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -3202,26 +2614,18 @@ def build_get_dictionary_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/dictionary/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_item_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3236,26 +2640,18 @@ def build_get_dictionary_item_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/dictionary/itemnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_item_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3270,26 +2666,18 @@ def build_get_dictionary_item_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/dictionary/itemempty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3304,27 +2692,21 @@ def build_get_dictionary_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/dictionary/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_dictionary_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[Dict[str, str]], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3355,9 +2737,8 @@ def build_put_dictionary_valid_request( @overload def build_put_dictionary_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3376,10 +2757,7 @@ def build_put_dictionary_valid_request( """ -def build_put_dictionary_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_dictionary_valid_request(**kwargs: Any) -> HttpRequest: """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. @@ -3399,20 +2777,15 @@ def build_put_dictionary_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/array/dictionary/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py deleted file mode 100644 index 2dd13a568e9..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyArrayLowLevel/bodyarraylowlevel/rest/array/_request_builders_py3.py +++ /dev/null @@ -1,3421 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import sys -from typing import Any, Dict, IO, List, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null array value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid array [1, 2, 3. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get empty array value []. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_empty_request( - *, - json: List[str], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value empty []. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "str" # Optional. - ] - """ - - -@overload -def build_put_empty_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value empty []. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_empty_request( - **kwargs: Any -) -> HttpRequest: - """Set array value empty []. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/empty" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_tfft_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean array value [true, false, false, true]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/boolean/tfft" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_boolean_tfft_request( - *, - json: List[bool], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value empty [true, false, false, true]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[bool] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - bool # Optional. - ] - """ - - -@overload -def build_put_boolean_tfft_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value empty [true, false, false, true]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_boolean_tfft_request( - **kwargs: Any -) -> HttpRequest: - """Set array value empty [true, false, false, true]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[bool] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/boolean/tfft" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean array value [true, null, false]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/boolean/true.null.false" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean array value [true, 'boolean', false]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/boolean/true.boolean.false" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_integer_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get integer array value [1, -1, 3, 300]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/integer/1.-1.3.300" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_integer_valid_request( - *, - json: List[int], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value empty [1, -1, 3, 300]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - 0 # Optional. - ] - """ - - -@overload -def build_put_integer_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value empty [1, -1, 3, 300]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_integer_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value empty [1, -1, 3, 300]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/integer/1.-1.3.300" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_int_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get integer array value [1, null, 0]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/integer/1.null.zero" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_int_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get integer array value [1, 'integer', 0]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/integer/1.integer.0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_long_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get integer array value [1, -1, 3, 300]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/long/1.-1.3.300" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_long_valid_request( - *, - json: List[int], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value empty [1, -1, 3, 300]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - 0 # Optional. - ] - """ - - -@overload -def build_put_long_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value empty [1, -1, 3, 300]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_long_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value empty [1, -1, 3, 300]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/long/1.-1.3.300" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_long_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get long array value [1, null, 0]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/long/1.null.zero" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_long_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get long array value [1, 'integer', 0]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/long/1.integer.0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_float_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get float array value [0, -0.01, 1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/float/0--0.01-1.2e20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_float_valid_request( - *, - json: List[float], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value [0, -0.01, 1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - 0.0 # Optional. - ] - """ - - -@overload -def build_put_float_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value [0, -0.01, 1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_float_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value [0, -0.01, 1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/float/0--0.01-1.2e20" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_float_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get float array value [0.0, null, -1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/float/0.0-null-1.2e20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_float_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean array value [1.0, 'number', 0.0]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/float/1.number.0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_double_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get float array value [0, -0.01, 1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/double/0--0.01-1.2e20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_double_valid_request( - *, - json: List[float], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value [0, -0.01, 1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - 0.0 # Optional. - ] - """ - - -@overload -def build_put_double_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value [0, -0.01, 1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_double_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value [0, -0.01, 1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/double/0--0.01-1.2e20" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_double_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get float array value [0.0, null, -1.2e20]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/double/0.0-null-1.2e20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_double_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean array value [1.0, 'number', 0.0]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/double/1.number.0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_string_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get string array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/string/foo1.foo2.foo3" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_string_valid_request( - *, - json: List[str], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "str" # Optional. - ] - """ - - -@overload -def build_put_string_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_string_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/string/foo1.foo2.foo3" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_enum_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get enum array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/enum/foo1.foo2.foo3" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_enum_valid_request( - *, - json: List[str], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "str" # Optional. - ] - """ - - -@overload -def build_put_enum_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_enum_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/enum/foo1.foo2.foo3" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_string_enum_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get enum array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/string-enum/foo1.foo2.foo3" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_string_enum_valid_request( - *, - json: List[str], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "str" # Optional. - ] - """ - - -@overload -def build_put_string_enum_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_string_enum_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value ['foo1', 'foo2', 'foo3']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/string-enum/foo1.foo2.foo3" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_string_with_null_request( - **kwargs: Any -) -> HttpRequest: - """Get string array value ['foo', null, 'foo2']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/string/foo.null.foo2" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_string_with_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get string array value ['foo', 123, 'foo2']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/string/foo.123.foo2" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_uuid_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/uuid/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_uuid_valid_request( - *, - json: List[str], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "str" # Optional. - ] - """ - - -@overload -def build_put_uuid_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_uuid_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/uuid/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_uuid_invalid_chars_request( - **kwargs: Any -) -> HttpRequest: - """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/uuid/invalidchars" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_valid_request( - *, - json: List[datetime.date], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[~datetime.date] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "2020-02-20" # Optional. - ] - """ - - -@overload -def build_put_date_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[~datetime.date] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get date array value ['2012-01-01', null, '1776-07-04']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date/invalidnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_invalid_chars_request( - **kwargs: Any -) -> HttpRequest: - """Get date array value ['2011-03-22', 'date']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date/invalidchars" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date-time/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_time_valid_request( - *, - json: List[datetime.datetime], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "2020-02-20 00:00:00" # Optional. - ] - """ - - -@overload -def build_put_date_time_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_time_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date-time/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get date array value ['2000-12-01t00:00:01z', null]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date-time/invalidnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_invalid_chars_request( - **kwargs: Any -) -> HttpRequest: - """Get date array value ['2000-12-01t00:00:01z', 'date-time']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date-time/invalidchars" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_rfc1123_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', - 'Wed, 12 Oct 1492 10:15:01 GMT']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date-time-rfc1123/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_time_rfc1123_valid_request( - *, - json: List[datetime.datetime], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "2020-02-20 00:00:00" # Optional. - ] - """ - - -@overload -def build_put_date_time_rfc1123_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_time_rfc1123_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/date-time-rfc1123/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_duration_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/duration/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_duration_valid_request( - *, - json: List[datetime.timedelta], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[~datetime.timedelta] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "1 day, 0:00:00" # Optional. - ] - """ - - -@overload -def build_put_duration_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_duration_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[~datetime.timedelta] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/duration/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_byte_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded - in base64. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/byte/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_byte_valid_request( - *, - json: List[bytes], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - bytes("bytes", encoding="utf-8") # Optional. - ] - """ - - -@overload -def build_put_byte_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_byte_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[bytes] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/byte/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_byte_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/byte/invalidnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_base64_url_request( - **kwargs: Any -) -> HttpRequest: - """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with - the items base64url encoded. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/prim/base64url/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_null_request( - **kwargs: Any -) -> HttpRequest: - """Get array of complex type null value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/complex/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get empty array of complex type []. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/complex/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_item_null_request( - **kwargs: Any -) -> HttpRequest: - """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, - 'string': '6'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/complex/itemnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_item_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, - 'string': '6'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/complex/itemempty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, - {'integer': 5, 'string': '6'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/complex/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_complex_valid_request( - *, - json: List[JSON], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[JSON] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - { - "integer": 0, # Optional. - "string": "str" # Optional. - } - ] - """ - - -@overload -def build_put_complex_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_complex_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[JSON] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/complex/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_null_request( - **kwargs: Any -) -> HttpRequest: - """Get a null array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/array/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get an empty array []. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/array/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_item_null_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/array/itemnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_item_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/array/itemempty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/array/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_array_valid_request( - *, - json: List[List[str]], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[list[str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - [ - "str" # Optional. - ] - ] - """ - - -@overload -def build_put_array_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_array_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[list[str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/array/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_null_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of Dictionaries with value null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/dictionary/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of Dictionaries of type with value []. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/dictionary/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_item_null_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/dictionary/itemnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_item_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/dictionary/itemempty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/dictionary/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_dictionary_valid_request( - *, - json: List[Dict[str, str]], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[dict[str, str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - { - "str": "str" # Optional. - } - ] - """ - - -@overload -def build_put_dictionary_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_dictionary_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[dict[str, str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/array/dictionary/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_client.py index 894d7367650..09ee933aae2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/_client.py @@ -28,7 +28,6 @@ class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-ap """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = BinaryWithContentTypeApplicationJsonConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/__init__.py index 7ce9e704698..497aaf1b829 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_file_request - from ._request_builders_py3 import build_binary_request -except (SyntaxError, ImportError): - from ._request_builders import build_file_request # type: ignore - from ._request_builders import build_binary_request # type: ignore +from ._request_builders import build_file_request +from ._request_builders import build_binary_request __all__ = [ "build_file_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py index 68681a601f1..b73dc5b1d7e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_file_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_file_request(*, content: IO, **kwargs: Any) -> HttpRequest: """Uploading json file. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -36,26 +32,18 @@ def build_file_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/binary/file" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, content=content, **kwargs) -def build_binary_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_binary_request(*, content: IO, **kwargs: Any) -> HttpRequest: """Uploading binary file. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -71,17 +59,12 @@ def build_binary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/binary/octet" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py deleted file mode 100644 index e799ccc5f91..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBinaryLowLevel/bodybinarylowlevel/rest/upload/_request_builders_py3.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, IO, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_file_request( - *, - content: IO, - **kwargs: Any -) -> HttpRequest: - """Uploading json file. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: JSON file with payload { "more": "cowbell" }. Required. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/binary/file" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_binary_request( - *, - content: IO, - **kwargs: Any -) -> HttpRequest: - """Uploading binary file. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Non-empty binary file. Required. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/binary/octet" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_client.py index af6ce9cb569..ef92aab6137 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-key """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestBoolTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/__init__.py index a4fff07ee74..ef53078c983 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/__init__.py @@ -6,20 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_true_request - from ._request_builders_py3 import build_put_true_request - from ._request_builders_py3 import build_get_false_request - from ._request_builders_py3 import build_put_false_request - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_invalid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_true_request # type: ignore - from ._request_builders import build_put_true_request # type: ignore - from ._request_builders import build_get_false_request # type: ignore - from ._request_builders import build_put_false_request # type: ignore - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore +from ._request_builders import build_get_true_request +from ._request_builders import build_put_true_request +from ._request_builders import build_get_false_request +from ._request_builders import build_put_false_request +from ._request_builders import build_get_null_request +from ._request_builders import build_get_invalid_request __all__ = [ "build_get_true_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py index 3daf65509bf..f2623176969 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_true_request(**kwargs: Any) -> HttpRequest: """Get true Boolean value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_get_true_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/bool/true" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_true_request(**kwargs: Any) -> HttpRequest: """Set Boolean value true. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -70,31 +58,22 @@ def build_put_true_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', True) # type: bool - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + json = kwargs.pop("json", True) # type: bool + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/bool/true" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_false_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_false_request(**kwargs: Any) -> HttpRequest: """Get false Boolean value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -108,26 +87,18 @@ def build_get_false_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/bool/false" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_false_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_false_request(**kwargs: Any) -> HttpRequest: """Set Boolean value false. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -144,31 +115,22 @@ def build_put_false_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - json = kwargs.pop('json', False) # type: bool - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + json = kwargs.pop("json", False) # type: bool + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/bool/false" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null Boolean value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -182,26 +144,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/bool/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get invalid Boolean value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -215,17 +169,12 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/bool/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py deleted file mode 100644 index 00d49474dc3..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyBooleanLowLevel/bodybooleanlowlevel/rest/bool/_request_builders_py3.py +++ /dev/null @@ -1,225 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_true_request( - **kwargs: Any -) -> HttpRequest: - """Get true Boolean value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/bool/true" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_true_request( - **kwargs: Any -) -> HttpRequest: - """Set Boolean value true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Default value is True. Note that overriding this default value may result in - unsupported behavior. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', True) # type: bool - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/bool/true" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_false_request( - **kwargs: Any -) -> HttpRequest: - """Get false Boolean value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/bool/false" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_false_request( - **kwargs: Any -) -> HttpRequest: - """Set Boolean value false. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. Default value is False. Note that overriding this default value may - result in unsupported behavior. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - json = kwargs.pop('json', False) # type: bool - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/bool/false" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null Boolean value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/bool/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid Boolean value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/bool/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_client.py index 986031a2642..ee8ab676bf0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-versi """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATByteServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/__init__.py index 9fdaa4a2115..e3c5ab02796 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/__init__.py @@ -6,18 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_empty_request - from ._request_builders_py3 import build_get_non_ascii_request - from ._request_builders_py3 import build_put_non_ascii_request - from ._request_builders_py3 import build_get_invalid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_empty_request # type: ignore - from ._request_builders import build_get_non_ascii_request # type: ignore - from ._request_builders import build_put_non_ascii_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_get_empty_request +from ._request_builders import build_get_non_ascii_request +from ._request_builders import build_put_non_ascii_request +from ._request_builders import build_get_invalid_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py index dc80370b996..b1af6d7a6cc 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null byte value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/byte/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get empty byte value ''. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/byte/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_non_ascii_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_non_ascii_request(**kwargs: Any) -> HttpRequest: """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,26 +80,18 @@ def build_get_non_ascii_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/byte/nonAscii" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_non_ascii_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_non_ascii_request(*, json: bytes, **kwargs: Any) -> HttpRequest: """Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -136,29 +108,21 @@ def build_put_non_ascii_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/byte/nonAscii" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get invalid byte value ':::SWAGGER::::'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -172,17 +136,12 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/byte/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py deleted file mode 100644 index 2dd9de749ff..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyByteLowLevel/bodybytelowlevel/rest/byte/_request_builders_py3.py +++ /dev/null @@ -1,186 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null byte value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/byte/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get empty byte value ''. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/byte/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_non_ascii_request( - **kwargs: Any -) -> HttpRequest: - """Get non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/byte/nonAscii" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_non_ascii_request( - *, - json: bytes, - **kwargs: Any -) -> HttpRequest: - """Put non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Base64-encoded non-ascii byte string hex(FF FE FD FC FB FA F9 F8 F7 F6). - Required. - :paramtype json: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/byte/nonAscii" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid byte value ':::SWAGGER::::'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/byte/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_client.py index 8d5269b4b54..5fe39643261 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/_client.py @@ -31,7 +31,6 @@ class AutoRestComplexTestService: # pylint: disable=client-accepts-api-version- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/__init__.py index 11147632432..9aafa008cb7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/__init__.py @@ -6,18 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_valid_request - from ._request_builders_py3 import build_put_valid_request - from ._request_builders_py3 import build_get_empty_request - from ._request_builders_py3 import build_put_empty_request - from ._request_builders_py3 import build_get_not_provided_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_valid_request # type: ignore - from ._request_builders import build_put_valid_request # type: ignore - from ._request_builders import build_get_empty_request # type: ignore - from ._request_builders import build_put_empty_request # type: ignore - from ._request_builders import build_get_not_provided_request # type: ignore +from ._request_builders import build_get_valid_request +from ._request_builders import build_put_valid_request +from ._request_builders import build_get_empty_request +from ._request_builders import build_put_empty_request +from ._request_builders import build_get_not_provided_request __all__ = [ "build_get_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py index a0f0b1230f3..fccc1658f22 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_valid_request(**kwargs: Any) -> HttpRequest: """Get complex types with array property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/array/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with array property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -91,10 +79,7 @@ def build_put_valid_request( @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with array property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -113,10 +98,7 @@ def build_put_valid_request( """ -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(**kwargs: Any) -> HttpRequest: """Put complex types with array property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -136,29 +118,21 @@ def build_put_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/array/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get complex types with array property which is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -172,27 +146,19 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/array/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with array property which is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -221,10 +187,7 @@ def build_put_empty_request( @overload -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with array property which is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -242,10 +205,7 @@ def build_put_empty_request( """ -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(**kwargs: Any) -> HttpRequest: """Put complex types with array property which is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -264,29 +224,21 @@ def build_put_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/array/empty" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_not_provided_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: """Get complex types with array property while server doesn't provide a response payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -300,17 +252,12 @@ def build_get_not_provided_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/array/notprovided" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py deleted file mode 100644 index 0284cdeeb68..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/array/_request_builders_py3.py +++ /dev/null @@ -1,319 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with array property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/array/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_valid_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with array property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick - brown fox jumps over the lazy dog". Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "array": [ - "str" # Optional. - ] - } - """ - - -@overload -def build_put_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with array property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The - quick brown fox jumps over the lazy dog". Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with array property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick - brown fox jumps over the lazy dog". Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/array/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with array property which is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/array/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_empty_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with array property which is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put an empty array. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "array": [ - "str" # Optional. - ] - } - """ - - -@overload -def build_put_empty_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with array property which is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put an empty array. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_empty_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with array property which is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put an empty array. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/array/empty" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_not_provided_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with array property while server doesn't provide a response payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/array/notprovided" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/__init__.py index 2ea66984c02..9b5f914f0e9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/__init__.py @@ -6,20 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_valid_request - from ._request_builders_py3 import build_put_valid_request - from ._request_builders_py3 import build_get_invalid_request - from ._request_builders_py3 import build_get_empty_request - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_not_provided_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_valid_request # type: ignore - from ._request_builders import build_put_valid_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore - from ._request_builders import build_get_empty_request # type: ignore - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_not_provided_request # type: ignore +from ._request_builders import build_get_valid_request +from ._request_builders import build_put_valid_request +from ._request_builders import build_get_invalid_request +from ._request_builders import build_get_empty_request +from ._request_builders import build_get_null_request +from ._request_builders import build_get_not_provided_request __all__ = [ "build_get_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py index 9d8715d0292..00cdf82d48b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_valid_request(**kwargs: Any) -> HttpRequest: """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/basic/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Please put {id: 2, name: 'abc', color: 'Magenta'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -92,10 +80,7 @@ def build_put_valid_request( @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Please put {id: 2, name: 'abc', color: 'Magenta'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -113,10 +98,7 @@ def build_put_valid_request( """ -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(**kwargs: Any) -> HttpRequest: """Please put {id: 2, name: 'abc', color: 'Magenta'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -137,34 +119,25 @@ def build_put_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-02-29")) # type: str - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2016-02-29")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/basic/valid" # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get a basic complex type that is invalid for the local strong type. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -178,26 +151,18 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/basic/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get a basic complex type that is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -211,26 +176,18 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/basic/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get a basic complex type whose properties are null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -244,26 +201,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/basic/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_not_provided_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: """Get a basic complex type while the server doesn't provide a response payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -277,17 +226,12 @@ def build_get_not_provided_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/basic/notprovided" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py deleted file mode 100644 index d29ff4d0331..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/basic/_request_builders_py3.py +++ /dev/null @@ -1,291 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get complex type {id: 2, name: 'abc', color: 'YELLOW'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/basic/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_valid_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Please put {id: 2, name: 'abc', color: 'Magenta'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put {id: 2, name: 'abc', color: 'Magenta'}. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "color": "str", # Optional. Known values are: "cyan", "Magenta", "YELLOW", - and "blacK". - "id": 0, # Optional. Basic Id. - "name": "str" # Optional. Name property with a very long description that - does not fit on a single line and a line break. - } - """ - - -@overload -def build_put_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Please put {id: 2, name: 'abc', color: 'Magenta'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put {id: 2, name: 'abc', color: 'Magenta'}. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_valid_request( - **kwargs: Any -) -> HttpRequest: - """Please put {id: 2, name: 'abc', color: 'Magenta'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put {id: 2, name: 'abc', color: 'Magenta'}. Is either a model type or a - IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-02-29")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/basic/valid" - - # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get a basic complex type that is invalid for the local strong type. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/basic/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get a basic complex type that is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/basic/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get a basic complex type whose properties are null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/basic/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_not_provided_request( - **kwargs: Any -) -> HttpRequest: - """Get a basic complex type while the server doesn't provide a response payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/basic/notprovided" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/__init__.py index 9d06b6a145a..643312c6e30 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/__init__.py @@ -6,20 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_valid_request - from ._request_builders_py3 import build_put_valid_request - from ._request_builders_py3 import build_get_empty_request - from ._request_builders_py3 import build_put_empty_request - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_not_provided_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_valid_request # type: ignore - from ._request_builders import build_put_valid_request # type: ignore - from ._request_builders import build_get_empty_request # type: ignore - from ._request_builders import build_put_empty_request # type: ignore - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_not_provided_request # type: ignore +from ._request_builders import build_get_valid_request +from ._request_builders import build_put_valid_request +from ._request_builders import build_get_empty_request +from ._request_builders import build_put_empty_request +from ._request_builders import build_get_null_request +from ._request_builders import build_get_not_provided_request __all__ = [ "build_get_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py index 88a72ea65e1..311e7d90b2c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_valid_request(**kwargs: Any) -> HttpRequest: """Get complex types with dictionary property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/dictionary/typed/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with dictionary property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -91,10 +79,7 @@ def build_put_valid_request( @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with dictionary property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -113,10 +98,7 @@ def build_put_valid_request( """ -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(**kwargs: Any) -> HttpRequest: """Put complex types with dictionary property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -137,29 +119,21 @@ def build_put_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/dictionary/typed/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get complex types with dictionary property which is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -173,27 +147,19 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/dictionary/typed/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with dictionary property which is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -222,10 +188,7 @@ def build_put_empty_request( @overload -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with dictionary property which is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -243,10 +206,7 @@ def build_put_empty_request( """ -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(**kwargs: Any) -> HttpRequest: """Put complex types with dictionary property which is empty. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -265,29 +225,21 @@ def build_put_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/dictionary/typed/empty" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get complex types with dictionary property which is null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -301,26 +253,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/dictionary/typed/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_not_provided_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: """Get complex types with dictionary property while server doesn't provide a response payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -334,17 +278,12 @@ def build_get_not_provided_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/dictionary/typed/notprovided" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py deleted file mode 100644 index 456c7c2fd54..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/dictionary/_request_builders_py3.py +++ /dev/null @@ -1,352 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with dictionary property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/dictionary/typed/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_valid_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with dictionary property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put a dictionary with 5 key-value pairs: "txt":"notepad", - "bmp":"mspaint", "xls":"excel", "exe":"", "":null. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "defaultProgram": { - "str": "str" # Optional. Dictionary of :code:``. - } - } - """ - - -@overload -def build_put_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with dictionary property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put a dictionary with 5 key-value pairs: "txt":"notepad", - "bmp":"mspaint", "xls":"excel", "exe":"", "":null. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with dictionary property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put a dictionary with 5 key-value pairs: "txt":"notepad", - "bmp":"mspaint", "xls":"excel", "exe":"", "":null. Is either a model type or a IO type. - Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/dictionary/typed/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with dictionary property which is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/dictionary/typed/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_empty_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with dictionary property which is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put an empty dictionary. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "defaultProgram": { - "str": "str" # Optional. Dictionary of :code:``. - } - } - """ - - -@overload -def build_put_empty_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with dictionary property which is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put an empty dictionary. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_empty_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with dictionary property which is empty. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put an empty dictionary. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/dictionary/typed/empty" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with dictionary property which is null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/dictionary/typed/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_not_provided_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with dictionary property while server doesn't provide a response payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/dictionary/typed/notprovided" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/__init__.py index 37b2d0a112d..2d06b2ea023 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_valid_request # type: ignore +from ._request_builders import build_get_valid_request __all__ = [ "build_get_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py index 10b7a8def38..b22419d74a7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_valid_request(**kwargs: Any) -> HttpRequest: """get_valid. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,17 +30,12 @@ def build_get_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/flatten/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py deleted file mode 100644 index 5380773b294..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/flattencomplex/_request_builders_py3.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_valid_request( - **kwargs: Any -) -> HttpRequest: - """get_valid. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/flatten/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/__init__.py index 83d94e4e60b..a0483f76f03 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_valid_request - from ._request_builders_py3 import build_put_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_valid_request # type: ignore - from ._request_builders import build_put_valid_request # type: ignore +from ._request_builders import build_get_valid_request +from ._request_builders import build_put_valid_request __all__ = [ "build_get_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py index dc83f20b393..7f50a9060c1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_valid_request(**kwargs: Any) -> HttpRequest: """Get complex types that extend others. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/inheritance/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that extend others. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,10 +88,7 @@ def build_put_valid_request( @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that extend others. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -123,10 +108,7 @@ def build_put_valid_request( """ -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(**kwargs: Any) -> HttpRequest: """Put complex types that extend others. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -148,20 +130,15 @@ def build_put_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/inheritance/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py deleted file mode 100644 index 81cb47fd7b0..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/inheritance/_request_builders_py3.py +++ /dev/null @@ -1,169 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types that extend others. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/inheritance/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_valid_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that extend others. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put a siamese with id=2, name="Siameee", color=green, breed=persion, - which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one - named "Tomato" with id=-1 and food="french fries". Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "breed": "str", # Optional. - "color": "str", # Optional. - "hates": [ - { - "food": "str", # Optional. - "id": 0, # Optional. - "name": "str" # Optional. - } - ], - "id": 0, # Optional. - "name": "str" # Optional. - } - """ - - -@overload -def build_put_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that extend others. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put a siamese with id=2, name="Siameee", color=green, breed=persion, - which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one - named "Tomato" with id=-1 and food="french fries". Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types that extend others. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put a siamese with id=2, name="Siameee", color=green, breed=persion, - which hates 2 dogs, the 1st one named "Potato" with id=1 and food="tomato", and the 2nd one - named "Tomato" with id=-1 and food="french fries". Is either a model type or a IO type. - Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/inheritance/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/__init__.py index 83d94e4e60b..a0483f76f03 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_valid_request - from ._request_builders_py3 import build_put_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_valid_request # type: ignore - from ._request_builders import build_put_valid_request # type: ignore +from ._request_builders import build_get_valid_request +from ._request_builders import build_put_valid_request __all__ = [ "build_get_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py index 430fc3a1db9..1ff9a93a548 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_valid_request(**kwargs: Any) -> HttpRequest: """Get complex types that are polymorphic and have recursive references. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphicrecursive/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic and have recursive references. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -194,10 +182,7 @@ def build_put_valid_request( @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic and have recursive references. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -267,10 +252,7 @@ def build_put_valid_request( """ -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(**kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic and have recursive references. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -341,20 +323,15 @@ def build_put_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphicrecursive/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py deleted file mode 100644 index d5bf1b4c577..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphicrecursive/_request_builders_py3.py +++ /dev/null @@ -1,362 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types that are polymorphic and have recursive references. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphicrecursive/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_valid_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic and have recursive references. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put a salmon that looks like this: - { - "fishtype": "salmon", - "species": "king", - "length": 1, - "age": 1, - "location": "alaska", - "iswild": true, - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "length": 20, - "age": 6, - "siblings": [ - { - "fishtype": "salmon", - "species": "coho", - "length": 2, - "age": 2, - "location": "atlantic", - "iswild": true, - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "length": 20, - "age": 6 - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # The input is polymorphic. The following are possible polymorphic inputs based off - discriminator "fishtype": - - # JSON input template for discriminator value "smart_salmon": - fish = { - "college_degree": "str", # Optional. - "fishtype": "smart_salmon", - "iswild": bool, # Optional. - "length": 0.0, # Required. - "location": "str", # Optional. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "cookiecuttershark": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "fishtype": "cookiecuttershark", - "length": 0.0, # Required. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "goblin": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "color": "gray", # Optional. Default value is "gray". Colors possible. Known - values are: "pink", "gray", "brown", "RED", and "red". - "fishtype": "goblin", - "jawsize": 0, # Optional. - "length": 0.0, # Required. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "sawshark": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "fishtype": "sawshark", - "length": 0.0, # Required. - "picture": bytes("bytes", encoding="utf-8"), # Optional. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template you can fill out and use as your body input. - json = fish - """ - - -@overload -def build_put_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic and have recursive references. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put a salmon that looks like this: - { - "fishtype": "salmon", - "species": "king", - "length": 1, - "age": 1, - "location": "alaska", - "iswild": true, - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "length": 20, - "age": 6, - "siblings": [ - { - "fishtype": "salmon", - "species": "coho", - "length": 2, - "age": 2, - "location": "atlantic", - "iswild": true, - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "length": 20, - "age": 6 - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic and have recursive references. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put a salmon that looks like this: - { - "fishtype": "salmon", - "species": "king", - "length": 1, - "age": 1, - "location": "alaska", - "iswild": true, - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "length": 20, - "age": 6, - "siblings": [ - { - "fishtype": "salmon", - "species": "coho", - "length": 2, - "age": 2, - "location": "atlantic", - "iswild": true, - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "length": 20, - "age": 6 - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "length": 10, - "age": 105 - } - ] - }. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphicrecursive/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/__init__.py index 3ea2d60203f..a92b467a018 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/__init__.py @@ -6,26 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_valid_request - from ._request_builders_py3 import build_put_valid_request - from ._request_builders_py3 import build_get_dot_syntax_request - from ._request_builders_py3 import build_get_composed_with_discriminator_request - from ._request_builders_py3 import build_get_composed_without_discriminator_request - from ._request_builders_py3 import build_get_complicated_request - from ._request_builders_py3 import build_put_complicated_request - from ._request_builders_py3 import build_put_missing_discriminator_request - from ._request_builders_py3 import build_put_valid_missing_required_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_valid_request # type: ignore - from ._request_builders import build_put_valid_request # type: ignore - from ._request_builders import build_get_dot_syntax_request # type: ignore - from ._request_builders import build_get_composed_with_discriminator_request # type: ignore - from ._request_builders import build_get_composed_without_discriminator_request # type: ignore - from ._request_builders import build_get_complicated_request # type: ignore - from ._request_builders import build_put_complicated_request # type: ignore - from ._request_builders import build_put_missing_discriminator_request # type: ignore - from ._request_builders import build_put_valid_missing_required_request # type: ignore +from ._request_builders import build_get_valid_request +from ._request_builders import build_put_valid_request +from ._request_builders import build_get_dot_syntax_request +from ._request_builders import build_get_composed_with_discriminator_request +from ._request_builders import build_get_composed_without_discriminator_request +from ._request_builders import build_get_complicated_request +from ._request_builders import build_put_complicated_request +from ._request_builders import build_put_missing_discriminator_request +from ._request_builders import build_put_valid_missing_required_request __all__ = [ "build_get_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py index 4a9a708e234..50a817cd96e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_valid_request(**kwargs: Any) -> HttpRequest: """Get complex types that are polymorphic. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -174,10 +162,7 @@ def build_put_valid_request( @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -227,10 +212,7 @@ def build_put_valid_request( """ -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(**kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -281,29 +263,21 @@ def build_put_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_dot_syntax_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dot_syntax_request(**kwargs: Any) -> HttpRequest: """Get complex types that are polymorphic, JSON key contains a dot. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -317,26 +291,18 @@ def build_get_dot_syntax_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/dotsyntax" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_composed_with_discriminator_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_composed_with_discriminator_request(**kwargs: Any) -> HttpRequest: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, with discriminator specified. Deserialization must NOT fail and use the discriminator type specified on the wire. @@ -352,26 +318,18 @@ def build_get_composed_with_discriminator_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/composedWithDiscriminator" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_composed_without_discriminator_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_composed_without_discriminator_request(**kwargs: Any) -> HttpRequest: """Get complex object composing a polymorphic scalar property and array property with polymorphic element type, without discriminator specified on wire. Deserialization must NOT fail and use the explicit type of the property. @@ -387,26 +345,18 @@ def build_get_composed_without_discriminator_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/composedWithoutDiscriminator" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complicated_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complicated_request(**kwargs: Any) -> HttpRequest: """Get complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -421,27 +371,19 @@ def build_get_complicated_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/complicated" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_complicated_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complicated_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -483,10 +425,7 @@ def build_put_complicated_request( @overload -def build_put_complicated_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complicated_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -505,10 +444,7 @@ def build_put_complicated_request( """ -def build_put_complicated_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complicated_request(**kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic, but not at the root of the hierarchy; also have additional properties. @@ -528,30 +464,24 @@ def build_put_complicated_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/complicated" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_missing_discriminator_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic, omitting the discriminator. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -593,9 +523,8 @@ def build_put_missing_discriminator_request( @overload def build_put_missing_discriminator_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic, omitting the discriminator. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -613,10 +542,7 @@ def build_put_missing_discriminator_request( """ -def build_put_missing_discriminator_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_missing_discriminator_request(**kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic, omitting the discriminator. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -635,30 +561,24 @@ def build_put_missing_discriminator_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/missingdiscriminator" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_put_valid_missing_required_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -767,9 +687,8 @@ def build_put_valid_missing_required_request( @overload def build_put_valid_missing_required_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -814,10 +733,7 @@ def build_put_valid_missing_required_request( """ -def build_put_valid_missing_required_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_missing_required_request(**kwargs: Any) -> HttpRequest: """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the request should not be allowed from the client. @@ -863,20 +779,15 @@ def build_put_valid_missing_required_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/polymorphism/missingrequired/invalid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py deleted file mode 100644 index befd49ff414..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/polymorphism/_request_builders_py3.py +++ /dev/null @@ -1,889 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types that are polymorphic. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_valid_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put a salmon that looks like this: - { - 'fishtype':'Salmon', - 'location':'alaska', - 'iswild':true, - 'species':'king', - 'length':1.0, - 'siblings':[ - { - 'fishtype':'Shark', - 'age':6, - 'birthday': '2012-01-05T01:00:00Z', - 'length':20.0, - 'species':'predator', - }, - { - 'fishtype':'Sawshark', - 'age':105, - 'birthday': '1900-01-05T01:00:00Z', - 'length':10.0, - 'picture': new Buffer([255, 255, 255, 255, 254]).toString('base64'), - 'species':'dangerous', - }, - { - 'fishtype': 'goblin', - 'age': 1, - 'birthday': '2015-08-08T00:00:00Z', - 'length': 30.0, - 'species': 'scary', - 'jawsize': 5 - } - ] - };. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # The input is polymorphic. The following are possible polymorphic inputs based off - discriminator "fishtype": - - # JSON input template for discriminator value "smart_salmon": - fish = { - "college_degree": "str", # Optional. - "fishtype": "smart_salmon", - "iswild": bool, # Optional. - "length": 0.0, # Required. - "location": "str", # Optional. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "cookiecuttershark": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "fishtype": "cookiecuttershark", - "length": 0.0, # Required. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "goblin": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "color": "gray", # Optional. Default value is "gray". Colors possible. Known - values are: "pink", "gray", "brown", "RED", and "red". - "fishtype": "goblin", - "jawsize": 0, # Optional. - "length": 0.0, # Required. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "sawshark": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "fishtype": "sawshark", - "length": 0.0, # Required. - "picture": bytes("bytes", encoding="utf-8"), # Optional. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template you can fill out and use as your body input. - json = fish - """ - - -@overload -def build_put_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put a salmon that looks like this: - { - 'fishtype':'Salmon', - 'location':'alaska', - 'iswild':true, - 'species':'king', - 'length':1.0, - 'siblings':[ - { - 'fishtype':'Shark', - 'age':6, - 'birthday': '2012-01-05T01:00:00Z', - 'length':20.0, - 'species':'predator', - }, - { - 'fishtype':'Sawshark', - 'age':105, - 'birthday': '1900-01-05T01:00:00Z', - 'length':10.0, - 'picture': new Buffer([255, 255, 255, 255, 254]).toString('base64'), - 'species':'dangerous', - }, - { - 'fishtype': 'goblin', - 'age': 1, - 'birthday': '2015-08-08T00:00:00Z', - 'length': 30.0, - 'species': 'scary', - 'jawsize': 5 - } - ] - };. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put a salmon that looks like this: - { - 'fishtype':'Salmon', - 'location':'alaska', - 'iswild':true, - 'species':'king', - 'length':1.0, - 'siblings':[ - { - 'fishtype':'Shark', - 'age':6, - 'birthday': '2012-01-05T01:00:00Z', - 'length':20.0, - 'species':'predator', - }, - { - 'fishtype':'Sawshark', - 'age':105, - 'birthday': '1900-01-05T01:00:00Z', - 'length':10.0, - 'picture': new Buffer([255, 255, 255, 255, 254]).toString('base64'), - 'species':'dangerous', - }, - { - 'fishtype': 'goblin', - 'age': 1, - 'birthday': '2015-08-08T00:00:00Z', - 'length': 30.0, - 'species': 'scary', - 'jawsize': 5 - } - ] - };. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dot_syntax_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types that are polymorphic, JSON key contains a dot. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/dotsyntax" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_composed_with_discriminator_request( - **kwargs: Any -) -> HttpRequest: - """Get complex object composing a polymorphic scalar property and array property with polymorphic - element type, with discriminator specified. Deserialization must NOT fail and use the - discriminator type specified on the wire. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/composedWithDiscriminator" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_composed_without_discriminator_request( - **kwargs: Any -) -> HttpRequest: - """Get complex object composing a polymorphic scalar property and array property with polymorphic - element type, without discriminator specified on wire. Deserialization must NOT fail and use - the explicit type of the property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/composedWithoutDiscriminator" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complicated_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types that are polymorphic, but not at the root of the hierarchy; also have - additional properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/complicated" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_complicated_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, but not at the root of the hierarchy; also have - additional properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # The input is polymorphic. The following are possible polymorphic inputs based off - discriminator "fishtype": - - # JSON input template for discriminator value "smart_salmon": - fish = { - "college_degree": "str", # Optional. - "fishtype": "smart_salmon", - "iswild": bool, # Optional. - "length": 0.0, # Required. - "location": "str", # Optional. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template you can fill out and use as your body input. - json = salmon - """ - - -@overload -def build_put_complicated_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, but not at the root of the hierarchy; also have - additional properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_complicated_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, but not at the root of the hierarchy; also have - additional properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/complicated" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_missing_discriminator_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, omitting the discriminator. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # The input is polymorphic. The following are possible polymorphic inputs based off - discriminator "fishtype": - - # JSON input template for discriminator value "smart_salmon": - fish = { - "college_degree": "str", # Optional. - "fishtype": "smart_salmon", - "iswild": bool, # Optional. - "length": 0.0, # Required. - "location": "str", # Optional. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template you can fill out and use as your body input. - json = salmon - """ - - -@overload -def build_put_missing_discriminator_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, omitting the discriminator. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_missing_discriminator_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, omitting the discriminator. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/missingdiscriminator" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_valid_missing_required_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the - request should not be allowed from the client. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please attempt put a sawshark that looks like this, the client should not allow - this data to be sent: - { - "fishtype": "sawshark", - "species": "snaggle toothed", - "length": 18.5, - "age": 2, - "birthday": "2013-06-01T01:00:00Z", - "location": "alaska", - "picture": base64(FF FF FF FF FE), - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "birthday": "2012-01-05T01:00:00Z", - "length": 20, - "age": 6 - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "picture": base64(FF FF FF FF FE), - "length": 10, - "age": 105 - } - ] - }. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # The input is polymorphic. The following are possible polymorphic inputs based off - discriminator "fishtype": - - # JSON input template for discriminator value "smart_salmon": - fish = { - "college_degree": "str", # Optional. - "fishtype": "smart_salmon", - "iswild": bool, # Optional. - "length": 0.0, # Required. - "location": "str", # Optional. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "cookiecuttershark": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "fishtype": "cookiecuttershark", - "length": 0.0, # Required. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "goblin": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "color": "gray", # Optional. Default value is "gray". Colors possible. Known - values are: "pink", "gray", "brown", "RED", and "red". - "fishtype": "goblin", - "jawsize": 0, # Optional. - "length": 0.0, # Required. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template for discriminator value "sawshark": - fish = { - "age": 0, # Optional. - "birthday": "2020-02-20 00:00:00", # Required. - "fishtype": "sawshark", - "length": 0.0, # Required. - "picture": bytes("bytes", encoding="utf-8"), # Optional. - "siblings": [ - fish - ], - "species": "str" # Optional. - } - - # JSON input template you can fill out and use as your body input. - json = fish - """ - - -@overload -def build_put_valid_missing_required_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the - request should not be allowed from the client. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please attempt put a sawshark that looks like this, the client should not - allow this data to be sent: - { - "fishtype": "sawshark", - "species": "snaggle toothed", - "length": 18.5, - "age": 2, - "birthday": "2013-06-01T01:00:00Z", - "location": "alaska", - "picture": base64(FF FF FF FF FE), - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "birthday": "2012-01-05T01:00:00Z", - "length": 20, - "age": 6 - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "picture": base64(FF FF FF FF FE), - "length": 10, - "age": 105 - } - ] - }. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_valid_missing_required_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types that are polymorphic, attempting to omit required 'birthday' field - the - request should not be allowed from the client. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please attempt put a sawshark that looks like this, the client should not allow - this data to be sent: - { - "fishtype": "sawshark", - "species": "snaggle toothed", - "length": 18.5, - "age": 2, - "birthday": "2013-06-01T01:00:00Z", - "location": "alaska", - "picture": base64(FF FF FF FF FE), - "siblings": [ - { - "fishtype": "shark", - "species": "predator", - "birthday": "2012-01-05T01:00:00Z", - "length": 20, - "age": 6 - }, - { - "fishtype": "sawshark", - "species": "dangerous", - "picture": base64(FF FF FF FF FE), - "length": 10, - "age": 105 - } - ] - }. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/polymorphism/missingrequired/invalid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/__init__.py index 4de6eb2c665..67b0cae15c0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/__init__.py @@ -6,52 +6,28 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_int_request - from ._request_builders_py3 import build_put_int_request - from ._request_builders_py3 import build_get_long_request - from ._request_builders_py3 import build_put_long_request - from ._request_builders_py3 import build_get_float_request - from ._request_builders_py3 import build_put_float_request - from ._request_builders_py3 import build_get_double_request - from ._request_builders_py3 import build_put_double_request - from ._request_builders_py3 import build_get_bool_request - from ._request_builders_py3 import build_put_bool_request - from ._request_builders_py3 import build_get_string_request - from ._request_builders_py3 import build_put_string_request - from ._request_builders_py3 import build_get_date_request - from ._request_builders_py3 import build_put_date_request - from ._request_builders_py3 import build_get_date_time_request - from ._request_builders_py3 import build_put_date_time_request - from ._request_builders_py3 import build_get_date_time_rfc1123_request - from ._request_builders_py3 import build_put_date_time_rfc1123_request - from ._request_builders_py3 import build_get_duration_request - from ._request_builders_py3 import build_put_duration_request - from ._request_builders_py3 import build_get_byte_request - from ._request_builders_py3 import build_put_byte_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_int_request # type: ignore - from ._request_builders import build_put_int_request # type: ignore - from ._request_builders import build_get_long_request # type: ignore - from ._request_builders import build_put_long_request # type: ignore - from ._request_builders import build_get_float_request # type: ignore - from ._request_builders import build_put_float_request # type: ignore - from ._request_builders import build_get_double_request # type: ignore - from ._request_builders import build_put_double_request # type: ignore - from ._request_builders import build_get_bool_request # type: ignore - from ._request_builders import build_put_bool_request # type: ignore - from ._request_builders import build_get_string_request # type: ignore - from ._request_builders import build_put_string_request # type: ignore - from ._request_builders import build_get_date_request # type: ignore - from ._request_builders import build_put_date_request # type: ignore - from ._request_builders import build_get_date_time_request # type: ignore - from ._request_builders import build_put_date_time_request # type: ignore - from ._request_builders import build_get_date_time_rfc1123_request # type: ignore - from ._request_builders import build_put_date_time_rfc1123_request # type: ignore - from ._request_builders import build_get_duration_request # type: ignore - from ._request_builders import build_put_duration_request # type: ignore - from ._request_builders import build_get_byte_request # type: ignore - from ._request_builders import build_put_byte_request # type: ignore +from ._request_builders import build_get_int_request +from ._request_builders import build_put_int_request +from ._request_builders import build_get_long_request +from ._request_builders import build_put_long_request +from ._request_builders import build_get_float_request +from ._request_builders import build_put_float_request +from ._request_builders import build_get_double_request +from ._request_builders import build_put_double_request +from ._request_builders import build_get_bool_request +from ._request_builders import build_put_bool_request +from ._request_builders import build_get_string_request +from ._request_builders import build_put_string_request +from ._request_builders import build_get_date_request +from ._request_builders import build_put_date_request +from ._request_builders import build_get_date_time_request +from ._request_builders import build_put_date_time_request +from ._request_builders import build_get_date_time_rfc1123_request +from ._request_builders import build_put_date_time_rfc1123_request +from ._request_builders import build_get_duration_request +from ._request_builders import build_put_duration_request +from ._request_builders import build_get_byte_request +from ._request_builders import build_put_byte_request __all__ = [ "build_get_int_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py index b8a049f2a21..b7b8a858add 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_int_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_request(**kwargs: Any) -> HttpRequest: """Get complex types with integer properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_int_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/integer" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_int_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_int_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with integer properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -89,10 +77,7 @@ def build_put_int_request( @overload -def build_put_int_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_int_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with integer properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -110,10 +95,7 @@ def build_put_int_request( """ -def build_put_int_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_int_request(**kwargs: Any) -> HttpRequest: """Put complex types with integer properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -132,29 +114,21 @@ def build_put_int_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/integer" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_long_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_long_request(**kwargs: Any) -> HttpRequest: """Get complex types with long properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -168,27 +142,19 @@ def build_get_long_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/long" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_long_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_long_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with long properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -216,10 +182,7 @@ def build_put_long_request( @overload -def build_put_long_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_long_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with long properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -237,10 +200,7 @@ def build_put_long_request( """ -def build_put_long_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_long_request(**kwargs: Any) -> HttpRequest: """Put complex types with long properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -260,29 +220,21 @@ def build_put_long_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/long" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_float_request(**kwargs: Any) -> HttpRequest: """Get complex types with float properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -296,27 +248,19 @@ def build_get_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/float" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_float_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with float properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -344,10 +288,7 @@ def build_put_float_request( @overload -def build_put_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_float_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with float properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -365,10 +306,7 @@ def build_put_float_request( """ -def build_put_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_float_request(**kwargs: Any) -> HttpRequest: """Put complex types with float properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -387,29 +325,21 @@ def build_put_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/float" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_double_request(**kwargs: Any) -> HttpRequest: """Get complex types with double properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -423,27 +353,19 @@ def build_get_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/double" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_double_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with double properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -473,10 +395,7 @@ def build_put_double_request( @overload -def build_put_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_double_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with double properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -495,10 +414,7 @@ def build_put_double_request( """ -def build_put_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_double_request(**kwargs: Any) -> HttpRequest: """Put complex types with double properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -519,29 +435,21 @@ def build_put_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/double" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_bool_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_bool_request(**kwargs: Any) -> HttpRequest: """Get complex types with bool properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -555,27 +463,19 @@ def build_get_bool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/bool" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_bool_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_bool_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with bool properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -603,10 +503,7 @@ def build_put_bool_request( @overload -def build_put_bool_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_bool_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with bool properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -624,10 +521,7 @@ def build_put_bool_request( """ -def build_put_bool_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_bool_request(**kwargs: Any) -> HttpRequest: """Put complex types with bool properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -646,29 +540,21 @@ def build_put_bool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/bool" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_request(**kwargs: Any) -> HttpRequest: """Get complex types with string properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -682,27 +568,19 @@ def build_get_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/string" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with string properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -731,10 +609,7 @@ def build_put_string_request( @overload -def build_put_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with string properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -752,10 +627,7 @@ def build_put_string_request( """ -def build_put_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_request(**kwargs: Any) -> HttpRequest: """Put complex types with string properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -775,29 +647,21 @@ def build_put_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/string" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_request(**kwargs: Any) -> HttpRequest: """Get complex types with date properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -811,27 +675,19 @@ def build_get_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/date" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with date properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -859,10 +715,7 @@ def build_put_date_request( @overload -def build_put_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with date properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -880,10 +733,7 @@ def build_put_date_request( """ -def build_put_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_request(**kwargs: Any) -> HttpRequest: """Put complex types with date properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -903,29 +753,21 @@ def build_put_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/date" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_request(**kwargs: Any) -> HttpRequest: """Get complex types with datetime properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -939,27 +781,19 @@ def build_get_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/datetime" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with datetime properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -988,10 +822,7 @@ def build_put_date_time_request( @overload -def build_put_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with datetime properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1010,10 +841,7 @@ def build_put_date_time_request( """ -def build_put_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_request(**kwargs: Any) -> HttpRequest: """Put complex types with datetime properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1033,29 +861,21 @@ def build_put_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/datetime" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_date_time_rfc1123_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: """Get complex types with datetimeRfc1123 properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1069,27 +889,21 @@ def build_get_date_time_rfc1123_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/datetimerfc1123" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_date_time_rfc1123_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put complex types with datetimeRfc1123 properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1119,9 +933,8 @@ def build_put_date_time_rfc1123_request( @overload def build_put_date_time_rfc1123_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put complex types with datetimeRfc1123 properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1140,10 +953,7 @@ def build_put_date_time_rfc1123_request( """ -def build_put_date_time_rfc1123_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_rfc1123_request(**kwargs: Any) -> HttpRequest: """Put complex types with datetimeRfc1123 properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1163,29 +973,21 @@ def build_put_date_time_rfc1123_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/datetimerfc1123" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_duration_request(**kwargs: Any) -> HttpRequest: """Get complex types with duration properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1199,27 +1001,19 @@ def build_get_duration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/duration" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_duration_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with duration properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1246,10 +1040,7 @@ def build_put_duration_request( @overload -def build_put_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_duration_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with duration properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1267,10 +1058,7 @@ def build_put_duration_request( """ -def build_put_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_duration_request(**kwargs: Any) -> HttpRequest: """Put complex types with duration properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1289,29 +1077,21 @@ def build_put_duration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/duration" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_byte_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_byte_request(**kwargs: Any) -> HttpRequest: """Get complex types with byte properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1325,27 +1105,19 @@ def build_get_byte_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/byte" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_byte_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_byte_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with byte properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1372,10 +1144,7 @@ def build_put_byte_request( @overload -def build_put_byte_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_byte_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types with byte properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1394,10 +1163,7 @@ def build_put_byte_request( """ -def build_put_byte_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_byte_request(**kwargs: Any) -> HttpRequest: """Put complex types with byte properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1417,20 +1183,15 @@ def build_put_byte_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/primitive/byte" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py deleted file mode 100644 index 09cab9678b7..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/primitive/_request_builders_py3.py +++ /dev/null @@ -1,1458 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_int_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with integer properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/integer" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_int_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with integer properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put -1 and 2. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field1": 0, # Optional. - "field2": 0 # Optional. - } - """ - - -@overload -def build_put_int_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with integer properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put -1 and 2. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_int_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with integer properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put -1 and 2. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/integer" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_long_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with long properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/long" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_long_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with long properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 1099511627775 and -999511627788. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field1": 0, # Optional. - "field2": 0 # Optional. - } - """ - - -@overload -def build_put_long_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with long properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put 1099511627775 and -999511627788. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_long_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with long properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 1099511627775 and -999511627788. Is either a model type or a IO type. - Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/long" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_float_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with float properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/float" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_float_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with float properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 1.05 and -0.003. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field1": 0.0, # Optional. - "field2": 0.0 # Optional. - } - """ - - -@overload -def build_put_float_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with float properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put 1.05 and -0.003. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_float_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with float properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 1.05 and -0.003. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/float" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_double_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with double properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/double" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_double_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with double properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 3e-100 and - -0.000000000000000000000000000000000000000000000000000000005. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field1": 0.0, # Optional. - "field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose": - 0.0 # Optional. - } - """ - - -@overload -def build_put_double_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with double properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put 3e-100 and - -0.000000000000000000000000000000000000000000000000000000005. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_double_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with double properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 3e-100 and - -0.000000000000000000000000000000000000000000000000000000005. Is either a model type or a IO - type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/double" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_bool_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with bool properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/bool" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_bool_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with bool properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put true and false. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field_false": bool, # Optional. - "field_true": bool # Optional. - } - """ - - -@overload -def build_put_bool_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with bool properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put true and false. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_bool_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with bool properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put true and false. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/bool" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_string_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with string properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/string" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_string_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with string properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 'goodrequest', '', and null. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "empty": "str", # Optional. - "field": "str", # Optional. - "null": "str" # Optional. - } - """ - - -@overload -def build_put_string_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with string properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put 'goodrequest', '', and null. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_string_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with string properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 'goodrequest', '', and null. Is either a model type or a IO type. - Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/string" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with date properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/date" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with date properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put '0001-01-01' and '2016-02-29'. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field": "2020-02-20", # Optional. - "leap": "2020-02-20" # Optional. - } - """ - - -@overload -def build_put_date_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with date properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put '0001-01-01' and '2016-02-29'. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with date properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put '0001-01-01' and '2016-02-29'. Is either a model type or a IO type. - Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/date" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with datetime properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/datetime" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_time_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with datetime properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. - Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field": "2020-02-20 00:00:00", # Optional. - "now": "2020-02-20 00:00:00" # Optional. - } - """ - - -@overload -def build_put_date_time_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with datetime properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. - Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with datetime properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put '0001-01-01T12:00:00-04:00' and '2015-05-18T11:38:00-08:00'. Is - either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/datetime" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_rfc1123_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with datetimeRfc1123 properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/datetimerfc1123" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_time_rfc1123_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with datetimeRfc1123 properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. - Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field": "2020-02-20 00:00:00", # Optional. - "now": "2020-02-20 00:00:00" # Optional. - } - """ - - -@overload -def build_put_date_time_rfc1123_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with datetimeRfc1123 properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 - GMT'. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_time_rfc1123_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with datetimeRfc1123 properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 'Mon, 01 Jan 0001 12:00:00 GMT' and 'Mon, 18 May 2015 11:38:00 GMT'. - Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/datetimerfc1123" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_duration_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with duration properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/duration" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_duration_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with duration properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 'P123DT22H14M12.011S'. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field": "1 day, 0:00:00" # Optional. - } - """ - - -@overload -def build_put_duration_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with duration properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put 'P123DT22H14M12.011S'. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_duration_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with duration properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put 'P123DT22H14M12.011S'. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/duration" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_byte_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types with byte properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/byte" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_byte_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with byte properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "field": bytes("bytes", encoding="utf-8") # Optional. - } - """ - - -@overload -def build_put_byte_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types with byte properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). - Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_byte_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types with byte properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Please put non-ascii byte string hex(FF FE FD FC 00 FA F9 F8 F7 F6). Is either a - model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/primitive/byte" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/__init__.py index 83d94e4e60b..a0483f76f03 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_valid_request - from ._request_builders_py3 import build_put_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_valid_request # type: ignore - from ._request_builders import build_put_valid_request # type: ignore +from ._request_builders import build_get_valid_request +from ._request_builders import build_put_valid_request __all__ = [ "build_get_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py index dc59b08395e..8dda6adf075 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_valid_request(**kwargs: Any) -> HttpRequest: """Get complex types that have readonly properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/readonlyproperty/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that have readonly properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -89,10 +77,7 @@ def build_put_valid_request( @overload -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put complex types that have readonly properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -110,10 +95,7 @@ def build_put_valid_request( """ -def build_put_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_valid_request(**kwargs: Any) -> HttpRequest: """Put complex types that have readonly properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -132,20 +114,15 @@ def build_put_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/complex/readonlyproperty/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py deleted file mode 100644 index 8e5c9e5af89..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyComplexLowLevel/bodycomplexlowlevel/rest/readonlyproperty/_request_builders_py3.py +++ /dev/null @@ -1,153 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get complex types that have readonly properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/readonlyproperty/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_valid_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that have readonly properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": "str", # Optional. - "size": 0 # Optional. - } - """ - - -@overload -def build_put_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put complex types that have readonly properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put complex types that have readonly properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/complex/readonlyproperty/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_client.py index 1fd6afc2644..ea89fd1baf7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-key """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestDateTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/__init__.py index 30de141574a..532e86e3778 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/__init__.py @@ -6,24 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_invalid_date_request - from ._request_builders_py3 import build_get_overflow_date_request - from ._request_builders_py3 import build_get_underflow_date_request - from ._request_builders_py3 import build_put_max_date_request - from ._request_builders_py3 import build_get_max_date_request - from ._request_builders_py3 import build_put_min_date_request - from ._request_builders_py3 import build_get_min_date_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_invalid_date_request # type: ignore - from ._request_builders import build_get_overflow_date_request # type: ignore - from ._request_builders import build_get_underflow_date_request # type: ignore - from ._request_builders import build_put_max_date_request # type: ignore - from ._request_builders import build_get_max_date_request # type: ignore - from ._request_builders import build_put_min_date_request # type: ignore - from ._request_builders import build_get_min_date_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_get_invalid_date_request +from ._request_builders import build_get_overflow_date_request +from ._request_builders import build_get_underflow_date_request +from ._request_builders import build_put_max_date_request +from ._request_builders import build_get_max_date_request +from ._request_builders import build_put_min_date_request +from ._request_builders import build_get_min_date_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py index 84e0cb6d223..fb0154b245c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null date value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/date/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_date_request(**kwargs: Any) -> HttpRequest: """Get invalid date value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -68,26 +56,18 @@ def build_get_invalid_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/date/invaliddate" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_overflow_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_overflow_date_request(**kwargs: Any) -> HttpRequest: """Get overflow date value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -101,26 +81,18 @@ def build_get_overflow_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/date/overflowdate" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_underflow_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_underflow_date_request(**kwargs: Any) -> HttpRequest: """Get underflow date value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -134,26 +106,18 @@ def build_get_underflow_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/date/underflowdate" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_max_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_max_date_request(*, json: datetime.date, **kwargs: Any) -> HttpRequest: """Put max date value 9999-12-31. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -169,29 +133,21 @@ def build_put_max_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/date/max" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_max_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_max_date_request(**kwargs: Any) -> HttpRequest: """Get max date value 9999-12-31. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -205,26 +161,18 @@ def build_get_max_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/date/max" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_min_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_min_date_request(*, json: datetime.date, **kwargs: Any) -> HttpRequest: """Put min date value 0000-01-01. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -240,29 +188,21 @@ def build_put_min_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/date/min" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_min_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_min_date_request(**kwargs: Any) -> HttpRequest: """Get min date value 0000-01-01. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -276,17 +216,12 @@ def build_get_min_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/date/min" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py deleted file mode 100644 index 6a26aa7c542..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateLowLevel/bodydatelowlevel/rest/date/_request_builders_py3.py +++ /dev/null @@ -1,290 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null date value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/date/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_date_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid date value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/date/invaliddate" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_overflow_date_request( - **kwargs: Any -) -> HttpRequest: - """Get overflow date value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/date/overflowdate" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_underflow_date_request( - **kwargs: Any -) -> HttpRequest: - """Get underflow date value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/date/underflowdate" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_max_date_request( - *, - json: datetime.date, - **kwargs: Any -) -> HttpRequest: - """Put max date value 9999-12-31. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: date body. Required. - :paramtype json: ~datetime.date - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/date/max" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_max_date_request( - **kwargs: Any -) -> HttpRequest: - """Get max date value 9999-12-31. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/date/max" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_min_date_request( - *, - json: datetime.date, - **kwargs: Any -) -> HttpRequest: - """Put min date value 0000-01-01. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: date body. Required. - :paramtype json: ~datetime.date - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/date/min" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_min_date_request( - **kwargs: Any -) -> HttpRequest: - """Get min date value 0000-01-01. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/date/min" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_client.py index b1dbb7888c7..723d904695c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestDateTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/__init__.py index 3a935a20ab7..801406bf87f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/__init__.py @@ -6,52 +6,28 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_invalid_request - from ._request_builders_py3 import build_get_overflow_request - from ._request_builders_py3 import build_get_underflow_request - from ._request_builders_py3 import build_put_utc_max_date_time_request - from ._request_builders_py3 import build_put_utc_max_date_time7_digits_request - from ._request_builders_py3 import build_get_utc_lowercase_max_date_time_request - from ._request_builders_py3 import build_get_utc_uppercase_max_date_time_request - from ._request_builders_py3 import build_get_utc_uppercase_max_date_time7_digits_request - from ._request_builders_py3 import build_put_local_positive_offset_max_date_time_request - from ._request_builders_py3 import build_get_local_positive_offset_lowercase_max_date_time_request - from ._request_builders_py3 import build_get_local_positive_offset_uppercase_max_date_time_request - from ._request_builders_py3 import build_put_local_negative_offset_max_date_time_request - from ._request_builders_py3 import build_get_local_negative_offset_uppercase_max_date_time_request - from ._request_builders_py3 import build_get_local_negative_offset_lowercase_max_date_time_request - from ._request_builders_py3 import build_put_utc_min_date_time_request - from ._request_builders_py3 import build_get_utc_min_date_time_request - from ._request_builders_py3 import build_put_local_positive_offset_min_date_time_request - from ._request_builders_py3 import build_get_local_positive_offset_min_date_time_request - from ._request_builders_py3 import build_put_local_negative_offset_min_date_time_request - from ._request_builders_py3 import build_get_local_negative_offset_min_date_time_request - from ._request_builders_py3 import build_get_local_no_offset_min_date_time_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore - from ._request_builders import build_get_overflow_request # type: ignore - from ._request_builders import build_get_underflow_request # type: ignore - from ._request_builders import build_put_utc_max_date_time_request # type: ignore - from ._request_builders import build_put_utc_max_date_time7_digits_request # type: ignore - from ._request_builders import build_get_utc_lowercase_max_date_time_request # type: ignore - from ._request_builders import build_get_utc_uppercase_max_date_time_request # type: ignore - from ._request_builders import build_get_utc_uppercase_max_date_time7_digits_request # type: ignore - from ._request_builders import build_put_local_positive_offset_max_date_time_request # type: ignore - from ._request_builders import build_get_local_positive_offset_lowercase_max_date_time_request # type: ignore - from ._request_builders import build_get_local_positive_offset_uppercase_max_date_time_request # type: ignore - from ._request_builders import build_put_local_negative_offset_max_date_time_request # type: ignore - from ._request_builders import build_get_local_negative_offset_uppercase_max_date_time_request # type: ignore - from ._request_builders import build_get_local_negative_offset_lowercase_max_date_time_request # type: ignore - from ._request_builders import build_put_utc_min_date_time_request # type: ignore - from ._request_builders import build_get_utc_min_date_time_request # type: ignore - from ._request_builders import build_put_local_positive_offset_min_date_time_request # type: ignore - from ._request_builders import build_get_local_positive_offset_min_date_time_request # type: ignore - from ._request_builders import build_put_local_negative_offset_min_date_time_request # type: ignore - from ._request_builders import build_get_local_negative_offset_min_date_time_request # type: ignore - from ._request_builders import build_get_local_no_offset_min_date_time_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_get_invalid_request +from ._request_builders import build_get_overflow_request +from ._request_builders import build_get_underflow_request +from ._request_builders import build_put_utc_max_date_time_request +from ._request_builders import build_put_utc_max_date_time7_digits_request +from ._request_builders import build_get_utc_lowercase_max_date_time_request +from ._request_builders import build_get_utc_uppercase_max_date_time_request +from ._request_builders import build_get_utc_uppercase_max_date_time7_digits_request +from ._request_builders import build_put_local_positive_offset_max_date_time_request +from ._request_builders import build_get_local_positive_offset_lowercase_max_date_time_request +from ._request_builders import build_get_local_positive_offset_uppercase_max_date_time_request +from ._request_builders import build_put_local_negative_offset_max_date_time_request +from ._request_builders import build_get_local_negative_offset_uppercase_max_date_time_request +from ._request_builders import build_get_local_negative_offset_lowercase_max_date_time_request +from ._request_builders import build_put_utc_min_date_time_request +from ._request_builders import build_get_utc_min_date_time_request +from ._request_builders import build_put_local_positive_offset_min_date_time_request +from ._request_builders import build_get_local_positive_offset_min_date_time_request +from ._request_builders import build_put_local_negative_offset_min_date_time_request +from ._request_builders import build_get_local_negative_offset_min_date_time_request +from ._request_builders import build_get_local_no_offset_min_date_time_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py index f826d33e37a..8dbac747c51 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null datetime value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get invalid datetime value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -68,26 +56,18 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_overflow_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_overflow_request(**kwargs: Any) -> HttpRequest: """Get overflow datetime value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -101,26 +81,18 @@ def build_get_overflow_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/overflow" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_underflow_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_underflow_request(**kwargs: Any) -> HttpRequest: """Get underflow datetime value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -134,26 +106,18 @@ def build_get_underflow_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/underflow" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_utc_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_utc_max_date_time_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put max datetime value 9999-12-31T23:59:59.999Z. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -169,29 +133,21 @@ def build_put_utc_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/utc" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_put_utc_max_date_time7_digits_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_utc_max_date_time7_digits_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -210,29 +166,21 @@ def build_put_utc_max_date_time7_digits_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/utc7ms" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_utc_lowercase_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_utc_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: """Get max datetime value 9999-12-31t23:59:59.999z. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -246,26 +194,18 @@ def build_get_utc_lowercase_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/utc/lowercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_utc_uppercase_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: """Get max datetime value 9999-12-31T23:59:59.999Z. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -279,26 +219,18 @@ def build_get_utc_uppercase_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/utc/uppercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_utc_uppercase_max_date_time7_digits_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_utc_uppercase_max_date_time7_digits_request(**kwargs: Any) -> HttpRequest: """Get max datetime value 9999-12-31T23:59:59.9999999Z. This is against the recommendation that asks for 3 digits, but allow to test what happens in @@ -315,26 +247,18 @@ def build_get_utc_uppercase_max_date_time7_digits_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/utc7ms/uppercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_local_positive_offset_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_local_positive_offset_max_date_time_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -350,29 +274,21 @@ def build_put_local_positive_offset_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/localpositiveoffset" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_local_positive_offset_lowercase_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_local_positive_offset_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999+14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -386,26 +302,18 @@ def build_get_local_positive_offset_lowercase_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/localpositiveoffset/lowercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_local_positive_offset_uppercase_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_local_positive_offset_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999+14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -419,26 +327,18 @@ def build_get_local_positive_offset_uppercase_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/localpositiveoffset/uppercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_local_negative_offset_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_local_negative_offset_max_date_time_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -454,29 +354,21 @@ def build_put_local_negative_offset_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/localnegativeoffset" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_local_negative_offset_uppercase_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_local_negative_offset_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: """Get max datetime value with positive num offset 9999-12-31T23:59:59.999-14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -490,26 +382,18 @@ def build_get_local_negative_offset_uppercase_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/localnegativeoffset/uppercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_local_negative_offset_lowercase_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_local_negative_offset_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: """Get max datetime value with positive num offset 9999-12-31t23:59:59.999-14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -523,26 +407,18 @@ def build_get_local_negative_offset_lowercase_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/max/localnegativeoffset/lowercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_utc_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_utc_min_date_time_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00Z. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -558,29 +434,21 @@ def build_put_utc_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/min/utc" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_utc_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: """Get min datetime value 0001-01-01T00:00:00Z. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -594,26 +462,18 @@ def build_get_utc_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/min/utc" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_local_positive_offset_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_local_positive_offset_min_date_time_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00+14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -629,29 +489,21 @@ def build_put_local_positive_offset_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/min/localpositiveoffset" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_local_positive_offset_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_local_positive_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: """Get min datetime value 0001-01-01T00:00:00+14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -665,26 +517,18 @@ def build_get_local_positive_offset_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/min/localpositiveoffset" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_local_negative_offset_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_local_negative_offset_min_date_time_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put min datetime value 0001-01-01T00:00:00-14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -700,29 +544,21 @@ def build_put_local_negative_offset_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/min/localnegativeoffset" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_local_negative_offset_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_local_negative_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: """Get min datetime value 0001-01-01T00:00:00-14:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -736,26 +572,18 @@ def build_get_local_negative_offset_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/min/localnegativeoffset" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_local_no_offset_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_local_no_offset_min_date_time_request(**kwargs: Any) -> HttpRequest: """Get min datetime value 0001-01-01T00:00:00. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -769,17 +597,12 @@ def build_get_local_no_offset_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetime/min/localnooffset" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py deleted file mode 100644 index 9989f5829fe..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeLowLevel/bodydatetimelowlevel/rest/datetime/_request_builders_py3.py +++ /dev/null @@ -1,784 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null datetime value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid datetime value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_overflow_request( - **kwargs: Any -) -> HttpRequest: - """Get overflow datetime value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/overflow" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_underflow_request( - **kwargs: Any -) -> HttpRequest: - """Get underflow datetime value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/underflow" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_utc_max_date_time_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put max datetime value 9999-12-31T23:59:59.999Z. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/utc" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_put_utc_max_date_time7_digits_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put max datetime value 9999-12-31T23:59:59.9999999Z. - - This is against the recommendation that asks for 3 digits, but allow to test what happens in - that scenario. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/utc7ms" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_utc_lowercase_max_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value 9999-12-31t23:59:59.999z. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/utc/lowercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_utc_uppercase_max_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value 9999-12-31T23:59:59.999Z. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/utc/uppercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_utc_uppercase_max_date_time7_digits_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value 9999-12-31T23:59:59.9999999Z. - - This is against the recommendation that asks for 3 digits, but allow to test what happens in - that scenario. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/utc7ms/uppercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_local_positive_offset_max_date_time_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/localpositiveoffset" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_local_positive_offset_lowercase_max_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value with positive num offset 9999-12-31t23:59:59.999+14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/localpositiveoffset/lowercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_local_positive_offset_uppercase_max_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value with positive num offset 9999-12-31T23:59:59.999+14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/localpositiveoffset/uppercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_local_negative_offset_max_date_time_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/localnegativeoffset" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_local_negative_offset_uppercase_max_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value with positive num offset 9999-12-31T23:59:59.999-14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/localnegativeoffset/uppercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_local_negative_offset_lowercase_max_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value with positive num offset 9999-12-31t23:59:59.999-14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/max/localnegativeoffset/lowercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_utc_min_date_time_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put min datetime value 0001-01-01T00:00:00Z. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/min/utc" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_utc_min_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get min datetime value 0001-01-01T00:00:00Z. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/min/utc" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_local_positive_offset_min_date_time_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put min datetime value 0001-01-01T00:00:00+14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/min/localpositiveoffset" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_local_positive_offset_min_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get min datetime value 0001-01-01T00:00:00+14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/min/localpositiveoffset" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_local_negative_offset_min_date_time_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put min datetime value 0001-01-01T00:00:00-14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/min/localnegativeoffset" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_local_negative_offset_min_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get min datetime value 0001-01-01T00:00:00-14:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/min/localnegativeoffset" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_local_no_offset_min_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get min datetime value 0001-01-01T00:00:00. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetime/min/localnooffset" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_client.py index d8e9ca030cf..8f4e1083fa7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestRFC1123DateTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/__init__.py index 63f5895326f..81753c44f04 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/__init__.py @@ -6,26 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_invalid_request - from ._request_builders_py3 import build_get_overflow_request - from ._request_builders_py3 import build_get_underflow_request - from ._request_builders_py3 import build_put_utc_max_date_time_request - from ._request_builders_py3 import build_get_utc_lowercase_max_date_time_request - from ._request_builders_py3 import build_get_utc_uppercase_max_date_time_request - from ._request_builders_py3 import build_put_utc_min_date_time_request - from ._request_builders_py3 import build_get_utc_min_date_time_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore - from ._request_builders import build_get_overflow_request # type: ignore - from ._request_builders import build_get_underflow_request # type: ignore - from ._request_builders import build_put_utc_max_date_time_request # type: ignore - from ._request_builders import build_get_utc_lowercase_max_date_time_request # type: ignore - from ._request_builders import build_get_utc_uppercase_max_date_time_request # type: ignore - from ._request_builders import build_put_utc_min_date_time_request # type: ignore - from ._request_builders import build_get_utc_min_date_time_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_get_invalid_request +from ._request_builders import build_get_overflow_request +from ._request_builders import build_get_underflow_request +from ._request_builders import build_put_utc_max_date_time_request +from ._request_builders import build_get_utc_lowercase_max_date_time_request +from ._request_builders import build_get_utc_uppercase_max_date_time_request +from ._request_builders import build_put_utc_min_date_time_request +from ._request_builders import build_get_utc_min_date_time_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py index 62a0903ae90..a19fe59b477 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null datetime value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get invalid datetime value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -68,26 +56,18 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_overflow_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_overflow_request(**kwargs: Any) -> HttpRequest: """Get overflow datetime value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -101,26 +81,18 @@ def build_get_overflow_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/overflow" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_underflow_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_underflow_request(**kwargs: Any) -> HttpRequest: """Get underflow datetime value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -134,26 +106,18 @@ def build_get_underflow_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/underflow" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_utc_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_utc_max_date_time_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -169,29 +133,21 @@ def build_put_utc_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/max" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_utc_lowercase_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_utc_lowercase_max_date_time_request(**kwargs: Any) -> HttpRequest: """Get max datetime value fri, 31 dec 9999 23:59:59 gmt. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -205,26 +161,18 @@ def build_get_utc_lowercase_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/max/lowercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_utc_uppercase_max_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_utc_uppercase_max_date_time_request(**kwargs: Any) -> HttpRequest: """Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -238,26 +186,18 @@ def build_get_utc_uppercase_max_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/max/uppercase" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_utc_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_utc_min_date_time_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -273,29 +213,21 @@ def build_put_utc_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/min" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_utc_min_date_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_utc_min_date_time_request(**kwargs: Any) -> HttpRequest: """Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -309,17 +241,12 @@ def build_get_utc_min_date_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/datetimerfc1123/min" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py deleted file mode 100644 index 07de78063ed..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDateTimeRfc1123LowLevel/bodydatetimerfc1123lowlevel/rest/datetimerfc1123/_request_builders_py3.py +++ /dev/null @@ -1,322 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null datetime value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid datetime value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_overflow_request( - **kwargs: Any -) -> HttpRequest: - """Get overflow datetime value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/overflow" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_underflow_request( - **kwargs: Any -) -> HttpRequest: - """Get underflow datetime value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/underflow" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_utc_max_date_time_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/max" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_utc_lowercase_max_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value fri, 31 dec 9999 23:59:59 gmt. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/max/lowercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_utc_uppercase_max_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get max datetime value FRI, 31 DEC 9999 23:59:59 GMT. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/max/uppercase" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_utc_min_date_time_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: datetime body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/min" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_utc_min_date_time_request( - **kwargs: Any -) -> HttpRequest: - """Get min datetime value Mon, 1 Jan 0001 00:00:00 GMT. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/datetimerfc1123/min" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_client.py index 22a3272d2a3..dae4ed498f0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATDictionaryServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/__init__.py index dbf5f8a21dd..02fe0307deb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/__init__.py @@ -6,138 +6,71 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_empty_request - from ._request_builders_py3 import build_put_empty_request - from ._request_builders_py3 import build_get_null_value_request - from ._request_builders_py3 import build_get_null_key_request - from ._request_builders_py3 import build_get_empty_string_key_request - from ._request_builders_py3 import build_get_invalid_request - from ._request_builders_py3 import build_get_boolean_tfft_request - from ._request_builders_py3 import build_put_boolean_tfft_request - from ._request_builders_py3 import build_get_boolean_invalid_null_request - from ._request_builders_py3 import build_get_boolean_invalid_string_request - from ._request_builders_py3 import build_get_integer_valid_request - from ._request_builders_py3 import build_put_integer_valid_request - from ._request_builders_py3 import build_get_int_invalid_null_request - from ._request_builders_py3 import build_get_int_invalid_string_request - from ._request_builders_py3 import build_get_long_valid_request - from ._request_builders_py3 import build_put_long_valid_request - from ._request_builders_py3 import build_get_long_invalid_null_request - from ._request_builders_py3 import build_get_long_invalid_string_request - from ._request_builders_py3 import build_get_float_valid_request - from ._request_builders_py3 import build_put_float_valid_request - from ._request_builders_py3 import build_get_float_invalid_null_request - from ._request_builders_py3 import build_get_float_invalid_string_request - from ._request_builders_py3 import build_get_double_valid_request - from ._request_builders_py3 import build_put_double_valid_request - from ._request_builders_py3 import build_get_double_invalid_null_request - from ._request_builders_py3 import build_get_double_invalid_string_request - from ._request_builders_py3 import build_get_string_valid_request - from ._request_builders_py3 import build_put_string_valid_request - from ._request_builders_py3 import build_get_string_with_null_request - from ._request_builders_py3 import build_get_string_with_invalid_request - from ._request_builders_py3 import build_get_date_valid_request - from ._request_builders_py3 import build_put_date_valid_request - from ._request_builders_py3 import build_get_date_invalid_null_request - from ._request_builders_py3 import build_get_date_invalid_chars_request - from ._request_builders_py3 import build_get_date_time_valid_request - from ._request_builders_py3 import build_put_date_time_valid_request - from ._request_builders_py3 import build_get_date_time_invalid_null_request - from ._request_builders_py3 import build_get_date_time_invalid_chars_request - from ._request_builders_py3 import build_get_date_time_rfc1123_valid_request - from ._request_builders_py3 import build_put_date_time_rfc1123_valid_request - from ._request_builders_py3 import build_get_duration_valid_request - from ._request_builders_py3 import build_put_duration_valid_request - from ._request_builders_py3 import build_get_byte_valid_request - from ._request_builders_py3 import build_put_byte_valid_request - from ._request_builders_py3 import build_get_byte_invalid_null_request - from ._request_builders_py3 import build_get_base64_url_request - from ._request_builders_py3 import build_get_complex_null_request - from ._request_builders_py3 import build_get_complex_empty_request - from ._request_builders_py3 import build_get_complex_item_null_request - from ._request_builders_py3 import build_get_complex_item_empty_request - from ._request_builders_py3 import build_get_complex_valid_request - from ._request_builders_py3 import build_put_complex_valid_request - from ._request_builders_py3 import build_get_array_null_request - from ._request_builders_py3 import build_get_array_empty_request - from ._request_builders_py3 import build_get_array_item_null_request - from ._request_builders_py3 import build_get_array_item_empty_request - from ._request_builders_py3 import build_get_array_valid_request - from ._request_builders_py3 import build_put_array_valid_request - from ._request_builders_py3 import build_get_dictionary_null_request - from ._request_builders_py3 import build_get_dictionary_empty_request - from ._request_builders_py3 import build_get_dictionary_item_null_request - from ._request_builders_py3 import build_get_dictionary_item_empty_request - from ._request_builders_py3 import build_get_dictionary_valid_request - from ._request_builders_py3 import build_put_dictionary_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_empty_request # type: ignore - from ._request_builders import build_put_empty_request # type: ignore - from ._request_builders import build_get_null_value_request # type: ignore - from ._request_builders import build_get_null_key_request # type: ignore - from ._request_builders import build_get_empty_string_key_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore - from ._request_builders import build_get_boolean_tfft_request # type: ignore - from ._request_builders import build_put_boolean_tfft_request # type: ignore - from ._request_builders import build_get_boolean_invalid_null_request # type: ignore - from ._request_builders import build_get_boolean_invalid_string_request # type: ignore - from ._request_builders import build_get_integer_valid_request # type: ignore - from ._request_builders import build_put_integer_valid_request # type: ignore - from ._request_builders import build_get_int_invalid_null_request # type: ignore - from ._request_builders import build_get_int_invalid_string_request # type: ignore - from ._request_builders import build_get_long_valid_request # type: ignore - from ._request_builders import build_put_long_valid_request # type: ignore - from ._request_builders import build_get_long_invalid_null_request # type: ignore - from ._request_builders import build_get_long_invalid_string_request # type: ignore - from ._request_builders import build_get_float_valid_request # type: ignore - from ._request_builders import build_put_float_valid_request # type: ignore - from ._request_builders import build_get_float_invalid_null_request # type: ignore - from ._request_builders import build_get_float_invalid_string_request # type: ignore - from ._request_builders import build_get_double_valid_request # type: ignore - from ._request_builders import build_put_double_valid_request # type: ignore - from ._request_builders import build_get_double_invalid_null_request # type: ignore - from ._request_builders import build_get_double_invalid_string_request # type: ignore - from ._request_builders import build_get_string_valid_request # type: ignore - from ._request_builders import build_put_string_valid_request # type: ignore - from ._request_builders import build_get_string_with_null_request # type: ignore - from ._request_builders import build_get_string_with_invalid_request # type: ignore - from ._request_builders import build_get_date_valid_request # type: ignore - from ._request_builders import build_put_date_valid_request # type: ignore - from ._request_builders import build_get_date_invalid_null_request # type: ignore - from ._request_builders import build_get_date_invalid_chars_request # type: ignore - from ._request_builders import build_get_date_time_valid_request # type: ignore - from ._request_builders import build_put_date_time_valid_request # type: ignore - from ._request_builders import build_get_date_time_invalid_null_request # type: ignore - from ._request_builders import build_get_date_time_invalid_chars_request # type: ignore - from ._request_builders import build_get_date_time_rfc1123_valid_request # type: ignore - from ._request_builders import build_put_date_time_rfc1123_valid_request # type: ignore - from ._request_builders import build_get_duration_valid_request # type: ignore - from ._request_builders import build_put_duration_valid_request # type: ignore - from ._request_builders import build_get_byte_valid_request # type: ignore - from ._request_builders import build_put_byte_valid_request # type: ignore - from ._request_builders import build_get_byte_invalid_null_request # type: ignore - from ._request_builders import build_get_base64_url_request # type: ignore - from ._request_builders import build_get_complex_null_request # type: ignore - from ._request_builders import build_get_complex_empty_request # type: ignore - from ._request_builders import build_get_complex_item_null_request # type: ignore - from ._request_builders import build_get_complex_item_empty_request # type: ignore - from ._request_builders import build_get_complex_valid_request # type: ignore - from ._request_builders import build_put_complex_valid_request # type: ignore - from ._request_builders import build_get_array_null_request # type: ignore - from ._request_builders import build_get_array_empty_request # type: ignore - from ._request_builders import build_get_array_item_null_request # type: ignore - from ._request_builders import build_get_array_item_empty_request # type: ignore - from ._request_builders import build_get_array_valid_request # type: ignore - from ._request_builders import build_put_array_valid_request # type: ignore - from ._request_builders import build_get_dictionary_null_request # type: ignore - from ._request_builders import build_get_dictionary_empty_request # type: ignore - from ._request_builders import build_get_dictionary_item_null_request # type: ignore - from ._request_builders import build_get_dictionary_item_empty_request # type: ignore - from ._request_builders import build_get_dictionary_valid_request # type: ignore - from ._request_builders import build_put_dictionary_valid_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_get_empty_request +from ._request_builders import build_put_empty_request +from ._request_builders import build_get_null_value_request +from ._request_builders import build_get_null_key_request +from ._request_builders import build_get_empty_string_key_request +from ._request_builders import build_get_invalid_request +from ._request_builders import build_get_boolean_tfft_request +from ._request_builders import build_put_boolean_tfft_request +from ._request_builders import build_get_boolean_invalid_null_request +from ._request_builders import build_get_boolean_invalid_string_request +from ._request_builders import build_get_integer_valid_request +from ._request_builders import build_put_integer_valid_request +from ._request_builders import build_get_int_invalid_null_request +from ._request_builders import build_get_int_invalid_string_request +from ._request_builders import build_get_long_valid_request +from ._request_builders import build_put_long_valid_request +from ._request_builders import build_get_long_invalid_null_request +from ._request_builders import build_get_long_invalid_string_request +from ._request_builders import build_get_float_valid_request +from ._request_builders import build_put_float_valid_request +from ._request_builders import build_get_float_invalid_null_request +from ._request_builders import build_get_float_invalid_string_request +from ._request_builders import build_get_double_valid_request +from ._request_builders import build_put_double_valid_request +from ._request_builders import build_get_double_invalid_null_request +from ._request_builders import build_get_double_invalid_string_request +from ._request_builders import build_get_string_valid_request +from ._request_builders import build_put_string_valid_request +from ._request_builders import build_get_string_with_null_request +from ._request_builders import build_get_string_with_invalid_request +from ._request_builders import build_get_date_valid_request +from ._request_builders import build_put_date_valid_request +from ._request_builders import build_get_date_invalid_null_request +from ._request_builders import build_get_date_invalid_chars_request +from ._request_builders import build_get_date_time_valid_request +from ._request_builders import build_put_date_time_valid_request +from ._request_builders import build_get_date_time_invalid_null_request +from ._request_builders import build_get_date_time_invalid_chars_request +from ._request_builders import build_get_date_time_rfc1123_valid_request +from ._request_builders import build_put_date_time_rfc1123_valid_request +from ._request_builders import build_get_duration_valid_request +from ._request_builders import build_put_duration_valid_request +from ._request_builders import build_get_byte_valid_request +from ._request_builders import build_put_byte_valid_request +from ._request_builders import build_get_byte_invalid_null_request +from ._request_builders import build_get_base64_url_request +from ._request_builders import build_get_complex_null_request +from ._request_builders import build_get_complex_empty_request +from ._request_builders import build_get_complex_item_null_request +from ._request_builders import build_get_complex_item_empty_request +from ._request_builders import build_get_complex_valid_request +from ._request_builders import build_put_complex_valid_request +from ._request_builders import build_get_array_null_request +from ._request_builders import build_get_array_empty_request +from ._request_builders import build_get_array_item_null_request +from ._request_builders import build_get_array_item_empty_request +from ._request_builders import build_get_array_valid_request +from ._request_builders import build_put_array_valid_request +from ._request_builders import build_get_dictionary_null_request +from ._request_builders import build_get_dictionary_empty_request +from ._request_builders import build_get_dictionary_item_null_request +from ._request_builders import build_get_dictionary_item_empty_request +from ._request_builders import build_get_dictionary_valid_request +from ._request_builders import build_put_dictionary_valid_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py index 4f15ffa9031..cc339f92eb9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders.py @@ -23,12 +23,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null dictionary value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -42,26 +38,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get empty dictionary value {}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -75,27 +63,19 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(*, json: Dict[str, str], content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -122,10 +102,7 @@ def build_put_empty_request( @overload -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -143,10 +120,7 @@ def build_put_empty_request( """ -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(**kwargs: Any) -> HttpRequest: """Set dictionary value empty {}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -165,29 +139,21 @@ def build_put_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/empty" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_null_value_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_value_request(**kwargs: Any) -> HttpRequest: """Get Dictionary with null value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -201,26 +167,18 @@ def build_get_null_value_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/nullvalue" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_null_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_key_request(**kwargs: Any) -> HttpRequest: """Get Dictionary with null key. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -234,26 +192,18 @@ def build_get_null_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/nullkey" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_empty_string_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_string_key_request(**kwargs: Any) -> HttpRequest: """Get Dictionary with key as empty string. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -267,26 +217,18 @@ def build_get_empty_string_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/keyemptystring" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get invalid Dictionary value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -300,26 +242,18 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_boolean_tfft_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: """Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true }. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -333,27 +267,21 @@ def build_get_boolean_tfft_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/boolean/tfft" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_boolean_tfft_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, bool], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -380,10 +308,7 @@ def build_put_boolean_tfft_request( @overload -def build_put_boolean_tfft_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_boolean_tfft_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -401,10 +326,7 @@ def build_put_boolean_tfft_request( """ -def build_put_boolean_tfft_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_boolean_tfft_request(**kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -423,29 +345,21 @@ def build_put_boolean_tfft_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/boolean/tfft" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_boolean_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get boolean dictionary value {"0": true, "1": null, "2": false }. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -459,26 +373,18 @@ def build_get_boolean_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/boolean/true.null.false" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_boolean_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -492,26 +398,18 @@ def build_get_boolean_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/boolean/true.boolean.false" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_integer_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -525,27 +423,21 @@ def build_get_integer_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/integer/1.-1.3.300" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_integer_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, int], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -572,10 +464,7 @@ def build_put_integer_valid_request( @overload -def build_put_integer_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_integer_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -593,10 +482,7 @@ def build_put_integer_valid_request( """ -def build_put_integer_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_integer_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -615,29 +501,21 @@ def build_put_integer_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/integer/1.-1.3.300" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_int_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get integer dictionary value {"0": 1, "1": null, "2": 0}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -651,26 +529,18 @@ def build_get_int_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/integer/1.null.zero" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_int_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get integer dictionary value {"0": 1, "1": "integer", "2": 0}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -684,26 +554,18 @@ def build_get_int_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/integer/1.integer.0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_long_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -717,27 +579,21 @@ def build_get_long_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/long/1.-1.3.300" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_long_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, int], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -764,10 +620,7 @@ def build_put_long_valid_request( @overload -def build_put_long_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_long_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -785,10 +638,7 @@ def build_put_long_valid_request( """ -def build_put_long_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_long_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -807,29 +657,21 @@ def build_put_long_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/long/1.-1.3.300" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_long_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get long dictionary value {"0": 1, "1": null, "2": 0}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -843,26 +685,18 @@ def build_get_long_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/long/1.null.zero" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_long_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get long dictionary value {"0": 1, "1": "integer", "2": 0}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -876,26 +710,18 @@ def build_get_long_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/long/1.integer.0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_float_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -909,27 +735,21 @@ def build_get_float_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/float/0--0.01-1.2e20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_float_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, float], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -956,10 +776,7 @@ def build_put_float_valid_request( @overload -def build_put_float_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_float_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -977,10 +794,7 @@ def build_put_float_valid_request( """ -def build_put_float_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_float_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -999,29 +813,21 @@ def build_put_float_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/float/0--0.01-1.2e20" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_float_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1035,26 +841,18 @@ def build_get_float_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/float/0.0-null-1.2e20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_float_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1068,26 +866,18 @@ def build_get_float_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/float/1.number.0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_double_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1101,27 +891,21 @@ def build_get_double_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/double/0--0.01-1.2e20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_double_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, float], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1148,10 +932,7 @@ def build_put_double_valid_request( @overload -def build_put_double_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_double_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1169,10 +950,7 @@ def build_put_double_valid_request( """ -def build_put_double_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_double_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1191,29 +969,21 @@ def build_put_double_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/double/0--0.01-1.2e20" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_double_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1227,26 +997,18 @@ def build_get_double_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/double/0.0-null-1.2e20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_double_invalid_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1260,26 +1022,18 @@ def build_get_double_invalid_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/double/1.number.0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_string_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: """Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1293,27 +1047,21 @@ def build_get_string_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/string/foo1.foo2.foo3" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_string_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, str], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1340,10 +1088,7 @@ def build_put_string_valid_request( @overload -def build_put_string_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1361,10 +1106,7 @@ def build_put_string_valid_request( """ -def build_put_string_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_string_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1383,29 +1125,21 @@ def build_put_string_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/string/foo1.foo2.foo3" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_string_with_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: """Get string dictionary value {"0": "foo", "1": null, "2": "foo2"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1419,26 +1153,18 @@ def build_get_string_with_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/string/foo.null.foo2" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_string_with_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: """Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1452,26 +1178,18 @@ def build_get_string_with_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/string/foo.123.foo2" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: """Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1485,27 +1203,21 @@ def build_get_date_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, datetime.date], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1532,10 +1244,7 @@ def build_put_date_valid_request( @overload -def build_put_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1553,10 +1262,7 @@ def build_put_date_valid_request( """ -def build_put_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1575,29 +1281,21 @@ def build_put_date_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_date_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1611,26 +1309,18 @@ def build_get_date_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date/invalidnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_invalid_chars_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: """Get date dictionary value {"0": "2011-03-22", "1": "date"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1644,26 +1334,18 @@ def build_get_date_invalid_chars_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date/invalidchars" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: """Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1678,27 +1360,21 @@ def build_get_date_time_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date-time/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, datetime.datetime], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1726,10 +1402,7 @@ def build_put_date_time_valid_request( @overload -def build_put_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1748,10 +1421,7 @@ def build_put_date_time_valid_request( """ -def build_put_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": "1492-10-12T10:15:01-08:00"}. @@ -1771,29 +1441,21 @@ def build_put_date_time_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date-time/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_date_time_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1807,26 +1469,18 @@ def build_get_date_time_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date-time/invalidnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_time_invalid_chars_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1840,26 +1494,18 @@ def build_get_date_time_invalid_chars_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date-time/invalidchars" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_date_time_rfc1123_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: """Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1874,27 +1520,21 @@ def build_get_date_time_rfc1123_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date-time-rfc1123/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_date_time_rfc1123_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, datetime.datetime], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1923,9 +1563,8 @@ def build_put_date_time_rfc1123_valid_request( @overload def build_put_date_time_rfc1123_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1944,10 +1583,7 @@ def build_put_date_time_rfc1123_valid_request( """ -def build_put_date_time_rfc1123_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. @@ -1967,29 +1603,21 @@ def build_put_date_time_rfc1123_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/date-time-rfc1123/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_duration_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: """Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2003,27 +1631,21 @@ def build_get_duration_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/duration/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_duration_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, datetime.timedelta], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2050,10 +1672,7 @@ def build_put_duration_valid_request( @overload -def build_put_duration_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_duration_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2071,10 +1690,7 @@ def build_put_duration_valid_request( """ -def build_put_duration_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_duration_valid_request(**kwargs: Any) -> HttpRequest: """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2093,29 +1709,21 @@ def build_put_duration_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/duration/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_byte_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each item encoded in base64. @@ -2130,27 +1738,21 @@ def build_get_byte_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/byte/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_byte_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, bytes], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64. @@ -2178,10 +1780,7 @@ def build_put_byte_valid_request( @overload -def build_put_byte_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_byte_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64. @@ -2200,10 +1799,7 @@ def build_put_byte_valid_request( """ -def build_put_byte_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_byte_valid_request(**kwargs: Any) -> HttpRequest: """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} with each elementencoded in base 64. @@ -2223,29 +1819,21 @@ def build_put_byte_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/byte/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_byte_invalid_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: """Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 encoded. @@ -2260,26 +1848,18 @@ def build_get_byte_invalid_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/byte/invalidnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_base64_url_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: """Get base64url dictionary value {"0": "a string that gets encoded with base64url", "1": "test string", "2": "Lorem ipsum"}. @@ -2294,26 +1874,18 @@ def build_get_base64_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/prim/base64url/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: """Get dictionary of complex type null value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2327,26 +1899,18 @@ def build_get_complex_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/complex/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: """Get empty dictionary of complex type {}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2360,26 +1924,18 @@ def build_get_complex_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/complex/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_item_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, "2": {"integer": 5, "string": "6"}}. @@ -2394,26 +1950,18 @@ def build_get_complex_item_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/complex/itemnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_item_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, "2": {"integer": 5, "string": "6"}}. @@ -2428,26 +1976,18 @@ def build_get_complex_item_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/complex/itemempty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_complex_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -2462,27 +2002,21 @@ def build_get_complex_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/complex/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_complex_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, JSON], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -2513,10 +2047,7 @@ def build_put_complex_valid_request( @overload -def build_put_complex_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complex_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -2535,10 +2066,7 @@ def build_put_complex_valid_request( """ -def build_put_complex_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complex_valid_request(**kwargs: Any) -> HttpRequest: """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. @@ -2558,29 +2086,21 @@ def build_put_complex_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/complex/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_array_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_null_request(**kwargs: Any) -> HttpRequest: """Get a null array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2594,26 +2114,18 @@ def build_get_array_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/array/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_array_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: """Get an empty dictionary {}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2627,26 +2139,18 @@ def build_get_array_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/array/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_array_item_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: """Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2660,26 +2164,18 @@ def build_get_array_item_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/array/itemnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_array_item_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: """Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2693,26 +2189,18 @@ def build_get_array_item_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/array/itemempty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_array_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: """Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2727,27 +2215,21 @@ def build_get_array_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/array/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_array_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, List[str]], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2777,10 +2259,7 @@ def build_put_array_valid_request( @overload -def build_put_array_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_array_valid_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2799,10 +2278,7 @@ def build_put_array_valid_request( """ -def build_put_array_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_array_valid_request(**kwargs: Any) -> HttpRequest: """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", "9"]}. @@ -2822,29 +2298,21 @@ def build_put_array_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/array/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: """Get an dictionaries of dictionaries with value null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2858,26 +2326,18 @@ def build_get_dictionary_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/dictionary/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -2891,26 +2351,18 @@ def build_get_dictionary_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/dictionary/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_item_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2925,26 +2377,18 @@ def build_get_dictionary_item_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/dictionary/itemnull" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_item_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2959,26 +2403,18 @@ def build_get_dictionary_item_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/dictionary/itemempty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -2994,27 +2430,21 @@ def build_get_dictionary_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/dictionary/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_dictionary_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: Dict[str, Dict[str, str]], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -3046,9 +2476,8 @@ def build_put_dictionary_valid_request( @overload def build_put_dictionary_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -3068,10 +2497,7 @@ def build_put_dictionary_valid_request( """ -def build_put_dictionary_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_dictionary_valid_request(**kwargs: Any) -> HttpRequest: """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. @@ -3092,20 +2518,15 @@ def build_put_dictionary_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/dictionary/dictionary/valid" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py deleted file mode 100644 index f52fa9ef889..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDictionaryLowLevel/bodydictionarylowlevel/rest/dictionary/_request_builders_py3.py +++ /dev/null @@ -1,3106 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -import sys -from typing import Any, Dict, IO, List, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null dictionary value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get empty dictionary value {}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_empty_request( - *, - json: Dict[str, str], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": "str" # Optional. - } - """ - - -@overload -def build_put_empty_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_empty_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/empty" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_null_value_request( - **kwargs: Any -) -> HttpRequest: - """Get Dictionary with null value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/nullvalue" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_null_key_request( - **kwargs: Any -) -> HttpRequest: - """Get Dictionary with null key. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/nullkey" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_empty_string_key_request( - **kwargs: Any -) -> HttpRequest: - """Get Dictionary with key as empty string. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/keyemptystring" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid Dictionary value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_tfft_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean dictionary value {"0": true, "1": false, "2": false, "3": true }. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/boolean/tfft" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_boolean_tfft_request( - *, - json: Dict[str, bool], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, bool] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": bool # Optional. - } - """ - - -@overload -def build_put_boolean_tfft_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_boolean_tfft_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": true, "1": false, "2": false, "3": true }. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, bool] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/boolean/tfft" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean dictionary value {"0": true, "1": null, "2": false }. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/boolean/true.null.false" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean dictionary value '{"0": true, "1": "boolean", "2": false}'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/boolean/true.boolean.false" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_integer_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/integer/1.-1.3.300" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_integer_valid_request( - *, - json: Dict[str, int], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": 0 # Optional. - } - """ - - -@overload -def build_put_integer_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_integer_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/integer/1.-1.3.300" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_int_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get integer dictionary value {"0": 1, "1": null, "2": 0}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/integer/1.null.zero" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_int_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get integer dictionary value {"0": 1, "1": "integer", "2": 0}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/integer/1.integer.0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_long_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get integer dictionary value {"0": 1, "1": -1, "2": 3, "3": 300}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/long/1.-1.3.300" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_long_valid_request( - *, - json: Dict[str, int], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": 0 # Optional. - } - """ - - -@overload -def build_put_long_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_long_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": 1, "1": -1, "2": 3, "3": 300}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/long/1.-1.3.300" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_long_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get long dictionary value {"0": 1, "1": null, "2": 0}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/long/1.null.zero" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_long_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get long dictionary value {"0": 1, "1": "integer", "2": 0}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/long/1.integer.0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_float_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/float/0--0.01-1.2e20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_float_valid_request( - *, - json: Dict[str, float], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": 0.0 # Optional. - } - """ - - -@overload -def build_put_float_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_float_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/float/0--0.01-1.2e20" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_float_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/float/0.0-null-1.2e20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_float_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/float/1.number.0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_double_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get float dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/double/0--0.01-1.2e20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_double_valid_request( - *, - json: Dict[str, float], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": 0.0 # Optional. - } - """ - - -@overload -def build_put_double_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_double_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/double/0--0.01-1.2e20" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_double_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get float dictionary value {"0": 0.0, "1": null, "2": 1.2e20}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/double/0.0-null-1.2e20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_double_invalid_string_request( - **kwargs: Any -) -> HttpRequest: - """Get boolean dictionary value {"0": 1.0, "1": "number", "2": 0.0}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/double/1.number.0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_string_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get string dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/string/foo1.foo2.foo3" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_string_valid_request( - *, - json: Dict[str, str], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": "str" # Optional. - } - """ - - -@overload -def build_put_string_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_string_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "foo1", "1": "foo2", "2": "foo3"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/string/foo1.foo2.foo3" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_string_with_null_request( - **kwargs: Any -) -> HttpRequest: - """Get string dictionary value {"0": "foo", "1": null, "2": "foo2"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/string/foo.null.foo2" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_string_with_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get string dictionary value {"0": "foo", "1": 123, "2": "foo2"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/string/foo.123.foo2" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get integer dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_valid_request( - *, - json: Dict[str, datetime.date], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, ~datetime.date] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": "2020-02-20" # Optional. - } - """ - - -@overload -def build_put_date_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "2000-12-01", "1": "1980-01-02", "2": "1492-10-12"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, ~datetime.date] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get date dictionary value {"0": "2012-01-01", "1": null, "2": "1776-07-04"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date/invalidnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_invalid_chars_request( - **kwargs: Any -) -> HttpRequest: - """Get date dictionary value {"0": "2011-03-22", "1": "date"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date/invalidchars" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get date-time dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", - "2": "1492-10-12T10:15:01-08:00"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date-time/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_time_valid_request( - *, - json: Dict[str, datetime.datetime], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": - "1492-10-12T10:15:01-08:00"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, ~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": "2020-02-20 00:00:00" # Optional. - } - """ - - -@overload -def build_put_date_time_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": - "1492-10-12T10:15:01-08:00"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_time_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "2000-12-01t00:00:01z", "1": "1980-01-02T00:11:35+01:00", "2": - "1492-10-12T10:15:01-08:00"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, ~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date-time/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": null}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date-time/invalidnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_invalid_chars_request( - **kwargs: Any -) -> HttpRequest: - """Get date dictionary value {"0": "2000-12-01t00:00:01z", "1": "date-time"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date-time/invalidchars" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_date_time_rfc1123_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan - 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date-time-rfc1123/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_date_time_rfc1123_valid_request( - *, - json: Dict[str, datetime.datetime], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 - 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, ~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": "2020-02-20 00:00:00" # Optional. - } - """ - - -@overload -def build_put_date_time_rfc1123_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 - 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_date_time_rfc1123_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value empty {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 - 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, ~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/date-time-rfc1123/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_duration_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get duration dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/duration/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_duration_valid_request( - *, - json: Dict[str, datetime.timedelta], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, ~datetime.timedelta] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": "1 day, 0:00:00" # Optional. - } - """ - - -@overload -def build_put_duration_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_duration_valid_request( - **kwargs: Any -) -> HttpRequest: - """Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, ~datetime.timedelta] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/duration/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_byte_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get byte dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} - with each item encoded in base64. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/byte/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_byte_valid_request( - *, - json: Dict[str, bytes], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} - with each elementencoded in base 64. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": bytes("bytes", encoding="utf-8") # Optional. - } - """ - - -@overload -def build_put_byte_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} - with each elementencoded in base 64. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_byte_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put the dictionary value {"0": hex(FF FF FF FA), "1": hex(01 02 03), "2": hex (25, 29, 43)} - with each elementencoded in base 64. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, bytes] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/byte/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_byte_invalid_null_request( - **kwargs: Any -) -> HttpRequest: - """Get byte dictionary value {"0": hex(FF FF FF FA), "1": null} with the first item base64 - encoded. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/byte/invalidnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_base64_url_request( - **kwargs: Any -) -> HttpRequest: - """Get base64url dictionary value {"0": "a string that gets encoded with base64url", "1": "test - string", "2": "Lorem ipsum"}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/prim/base64url/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_null_request( - **kwargs: Any -) -> HttpRequest: - """Get dictionary of complex type null value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/complex/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get empty dictionary of complex type {}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/complex/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_item_null_request( - **kwargs: Any -) -> HttpRequest: - """Get dictionary of complex type with null item {"0": {"integer": 1, "string": "2"}, "1": null, - "2": {"integer": 5, "string": "6"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/complex/itemnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_item_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get dictionary of complex type with empty item {"0": {"integer": 1, "string": "2"}, "1:" {}, - "2": {"integer": 5, "string": "6"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/complex/itemempty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_complex_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get dictionary of complex type with {"0": {"integer": 1, "string": "2"}, "1": {"integer": 3, - "string": "4"}, "2": {"integer": 5, "string": "6"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/complex/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_complex_valid_request( - *, - json: Dict[str, JSON], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": - {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, JSON] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": { - "integer": 0, # Optional. - "string": "str" # Optional. - } - } - """ - - -@overload -def build_put_complex_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": - {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_complex_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put an dictionary of complex type with values {"0": {"integer": 1, "string": "2"}, "1": - {"integer": 3, "string": "4"}, "2": {"integer": 5, "string": "6"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, JSON] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/complex/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_null_request( - **kwargs: Any -) -> HttpRequest: - """Get a null array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/array/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get an empty dictionary {}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/array/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_item_null_request( - **kwargs: Any -) -> HttpRequest: - """Get an dictionary of array of strings {"0": ["1", "2", "3"], "1": null, "2": ["7", "8", "9"]}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/array/itemnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_item_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of array of strings [{"0": ["1", "2", "3"], "1": [], "2": ["7", "8", "9"]}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/array/itemempty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get an array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", - "9"]}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/array/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_array_valid_request( - *, - json: Dict[str, List[str]], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", - "9"]}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, list[str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": [ - "str" # Optional. - ] - } - """ - - -@overload -def build_put_array_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", - "9"]}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_array_valid_request( - **kwargs: Any -) -> HttpRequest: - """Put An array of array of strings {"0": ["1", "2", "3"], "1": ["4", "5", "6"], "2": ["7", "8", - "9"]}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, list[str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/array/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_null_request( - **kwargs: Any -) -> HttpRequest: - """Get an dictionaries of dictionaries with value null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/dictionary/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get an dictionaries of dictionaries of type with value {}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/dictionary/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_item_null_request( - **kwargs: Any -) -> HttpRequest: - """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": - "two", "3": "three"}, "1": null, "2": {"7": "seven", "8": "eight", "9": "nine"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/dictionary/itemnull" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_item_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": - "two", "3": "three"}, "1": {}, "2": {"7": "seven", "8": "eight", "9": "nine"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/dictionary/itemempty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": - "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": - "eight", "9": "nine"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/dictionary/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_dictionary_valid_request( - *, - json: Dict[str, Dict[str, str]], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": - "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": - "eight", "9": "nine"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: dict[str, dict[str, str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": { - "str": "str" # Optional. - } - } - """ - - -@overload -def build_put_dictionary_valid_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": - "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": - "eight", "9": "nine"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_dictionary_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get an dictionaries of dictionaries of type with value {"0": {"1": "one", "2": - "two", "3": "three"}, "1": {"4": "four", "5": "five", "6": "six"}, "2": {"7": "seven", "8": - "eight", "9": "nine"}}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a dict type or a IO type. Required. - :paramtype json: dict[str, dict[str, str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/dictionary/dictionary/valid" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_client.py index 38b2870513b..cf207cd4ee4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py index 2551fd5500f..920665f48c7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_put_positive_duration_request - from ._request_builders_py3 import build_get_positive_duration_request - from ._request_builders_py3 import build_get_invalid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_put_positive_duration_request # type: ignore - from ._request_builders import build_get_positive_duration_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_put_positive_duration_request +from ._request_builders import build_get_positive_duration_request +from ._request_builders import build_get_invalid_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py index 5e2205c0839..e178029cc3a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null duration value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/duration/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_positive_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_positive_duration_request(*, json: datetime.timedelta, **kwargs: Any) -> HttpRequest: """Put a positive duration value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -70,29 +58,21 @@ def build_put_positive_duration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/duration/positiveduration" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_positive_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_positive_duration_request(**kwargs: Any) -> HttpRequest: """Get a positive duration value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -106,26 +86,18 @@ def build_get_positive_duration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/duration/positiveduration" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get an invalid duration value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -139,17 +111,12 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/duration/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py deleted file mode 100644 index ba37135e278..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyDurationLowLevel/bodydurationlowlevel/rest/duration/_request_builders_py3.py +++ /dev/null @@ -1,154 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null duration value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/duration/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_positive_duration_request( - *, - json: datetime.timedelta, - **kwargs: Any -) -> HttpRequest: - """Put a positive duration value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: duration body. Required. - :paramtype json: ~datetime.timedelta - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/duration/positiveduration" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_positive_duration_request( - **kwargs: Any -) -> HttpRequest: - """Get a positive duration value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/duration/positiveduration" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get an invalid duration value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/duration/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_client.py index 159dcad24bf..938cd4e9b24 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-versi """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATFileServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/__init__.py index 7ac5971aa0b..528eba3ed70 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_file_request - from ._request_builders_py3 import build_get_file_large_request - from ._request_builders_py3 import build_get_empty_file_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_file_request # type: ignore - from ._request_builders import build_get_file_large_request # type: ignore - from ._request_builders import build_get_empty_file_request # type: ignore +from ._request_builders import build_get_file_request +from ._request_builders import build_get_file_large_request +from ._request_builders import build_get_empty_file_request __all__ = [ "build_get_file_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders.py index 5a506ecc0d0..c3c1b2b1177 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_file_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_file_request(**kwargs: Any) -> HttpRequest: """Get file. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_get_file_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "image/png, application/json") + accept = _headers.pop("Accept", "image/png, application/json") # Construct URL _url = "/files/stream/nonempty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_file_large_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_file_large_request(**kwargs: Any) -> HttpRequest: """Get a large file. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get_file_large_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "image/png, application/json") + accept = _headers.pop("Accept", "image/png, application/json") # Construct URL _url = "/files/stream/verylarge" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_empty_file_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_file_request(**kwargs: Any) -> HttpRequest: """Get empty file. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,17 +80,12 @@ def build_get_empty_file_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "image/png, application/json") + accept = _headers.pop("Accept", "image/png, application/json") # Construct URL _url = "/files/stream/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders_py3.py deleted file mode 100644 index fe12c5af0ea..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFileLowLevel/bodyfilelowlevel/rest/files/_request_builders_py3.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_file_request( - **kwargs: Any -) -> HttpRequest: - """Get file. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "image/png, application/json") - - # Construct URL - _url = "/files/stream/nonempty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_file_large_request( - **kwargs: Any -) -> HttpRequest: - """Get a large file. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "image/png, application/json") - - # Construct URL - _url = "/files/stream/verylarge" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_empty_file_request( - **kwargs: Any -) -> HttpRequest: - """Get empty file. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "image/png, application/json") - - # Construct URL - _url = "/files/stream/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_client.py index c8bc0a4ddb8..f0bbee8a851 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-v """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATFormDataServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/__init__.py index f7d990f66f0..88403b5aa98 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_upload_file_request - from ._request_builders_py3 import build_upload_file_via_body_request - from ._request_builders_py3 import build_upload_files_request -except (SyntaxError, ImportError): - from ._request_builders import build_upload_file_request # type: ignore - from ._request_builders import build_upload_file_via_body_request # type: ignore - from ._request_builders import build_upload_files_request # type: ignore +from ._request_builders import build_upload_file_request +from ._request_builders import build_upload_file_via_body_request +from ._request_builders import build_upload_files_request __all__ = [ "build_upload_file_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py index 05f20f25c6c..509c5fce2a6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_upload_file_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_upload_file_request(**kwargs: Any) -> HttpRequest: """Upload file. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -42,29 +38,21 @@ def build_upload_file_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/octet-stream, application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/octet-stream, application/json") # Construct URL _url = "/formdata/stream/uploadfile" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_upload_file_via_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_upload_file_via_body_request(*, content: IO, **kwargs: Any) -> HttpRequest: """Upload file. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -80,29 +68,21 @@ def build_upload_file_via_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/octet-stream, application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/octet-stream, application/json") # Construct URL _url = "/formdata/stream/uploadfile" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_upload_files_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_upload_files_request(**kwargs: Any) -> HttpRequest: """Upload multiple files. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -124,20 +104,15 @@ def build_upload_files_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/octet-stream, application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/octet-stream, application/json") # Construct URL _url = "/formdata/stream/uploadfiles" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py deleted file mode 100644 index 99555283778..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormDataLowLevel/bodyformdatalowlevel/rest/formdata/_request_builders_py3.py +++ /dev/null @@ -1,143 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, IO, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_upload_file_request( - **kwargs: Any -) -> HttpRequest: - """Upload file. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - files = { - "str": {} # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/octet-stream, application/json") - - # Construct URL - _url = "/formdata/stream/uploadfile" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_upload_file_via_body_request( - *, - content: IO, - **kwargs: Any -) -> HttpRequest: - """Upload file. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: File to upload. Required. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/octet-stream, application/json") - - # Construct URL - _url = "/formdata/stream/uploadfile" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_upload_files_request( - **kwargs: Any -) -> HttpRequest: - """Upload multiple files. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - files = { - "str": {} # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/octet-stream, application/json") - - # Construct URL - _url = "/formdata/stream/uploadfiles" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_client.py index 9de4c35682c..d9468e71a20 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/_client.py @@ -28,7 +28,6 @@ class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-key """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = BodyFormsDataURLEncodedConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py index c2a1a3cee7d..bfaf39986c5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_update_pet_with_form_request - from ._request_builders_py3 import build_partial_constant_body_request -except (SyntaxError, ImportError): - from ._request_builders import build_update_pet_with_form_request # type: ignore - from ._request_builders import build_partial_constant_body_request # type: ignore +from ._request_builders import build_update_pet_with_form_request +from ._request_builders import build_partial_constant_body_request __all__ = [ "build_update_pet_with_form_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py index 81497fe0e1b..b8e1fc04127 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders.py @@ -16,13 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_update_pet_with_form_request( - pet_id, # type: int - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_update_pet_with_form_request(pet_id: int, **kwargs: Any) -> HttpRequest: """Updates a pet in the store with form data. Updates a pet in the store with form data. @@ -48,31 +43,23 @@ def build_update_pet_with_form_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/formsdataurlencoded/pet/add/{petId}" path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, 'int'), + "petId": _SERIALIZER.url("pet_id", pet_id, "int"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_partial_constant_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_partial_constant_body_request(**kwargs: Any) -> HttpRequest: """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: 'foo', service: 'bar' } to pass the test. @@ -95,17 +82,12 @@ def build_partial_constant_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/formsdataurlencoded/partialConstantBody" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py deleted file mode 100644 index 41a1fd5c812..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyFormUrlEncodedDataLowLevel/bodyformurlencodeddatalowlevel/rest/formdataurlencoded/_request_builders_py3.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_update_pet_with_form_request( - pet_id: int, - **kwargs: Any -) -> HttpRequest: - """Updates a pet in the store with form data. - - Updates a pet in the store with form data. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param pet_id: ID of pet that needs to be updated. Required. - :type pet_id: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - data = { - "str": {} # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/formsdataurlencoded/pet/add/{petId}" - path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, 'int'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_partial_constant_body_request( - **kwargs: Any -) -> HttpRequest: - """Test a partially constant formdata body. Pass in { grant_type: 'access_token', access_token: - 'foo', service: 'bar' } to pass the test. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - data = { - "str": {} # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/formsdataurlencoded/partialConstantBody" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_client.py index f19808c04ef..d1820e74f76 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestIntegerTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/__init__.py index 9ef9986b288..3bf0224cb44 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/__init__.py @@ -6,36 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_invalid_request - from ._request_builders_py3 import build_get_overflow_int32_request - from ._request_builders_py3 import build_get_underflow_int32_request - from ._request_builders_py3 import build_get_overflow_int64_request - from ._request_builders_py3 import build_get_underflow_int64_request - from ._request_builders_py3 import build_put_max32_request - from ._request_builders_py3 import build_put_max64_request - from ._request_builders_py3 import build_put_min32_request - from ._request_builders_py3 import build_put_min64_request - from ._request_builders_py3 import build_get_unix_time_request - from ._request_builders_py3 import build_put_unix_time_date_request - from ._request_builders_py3 import build_get_invalid_unix_time_request - from ._request_builders_py3 import build_get_null_unix_time_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_invalid_request # type: ignore - from ._request_builders import build_get_overflow_int32_request # type: ignore - from ._request_builders import build_get_underflow_int32_request # type: ignore - from ._request_builders import build_get_overflow_int64_request # type: ignore - from ._request_builders import build_get_underflow_int64_request # type: ignore - from ._request_builders import build_put_max32_request # type: ignore - from ._request_builders import build_put_max64_request # type: ignore - from ._request_builders import build_put_min32_request # type: ignore - from ._request_builders import build_put_min64_request # type: ignore - from ._request_builders import build_get_unix_time_request # type: ignore - from ._request_builders import build_put_unix_time_date_request # type: ignore - from ._request_builders import build_get_invalid_unix_time_request # type: ignore - from ._request_builders import build_get_null_unix_time_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_get_invalid_request +from ._request_builders import build_get_overflow_int32_request +from ._request_builders import build_get_underflow_int32_request +from ._request_builders import build_get_overflow_int64_request +from ._request_builders import build_get_underflow_int64_request +from ._request_builders import build_put_max32_request +from ._request_builders import build_put_max64_request +from ._request_builders import build_put_min32_request +from ._request_builders import build_put_min64_request +from ._request_builders import build_get_unix_time_request +from ._request_builders import build_put_unix_time_date_request +from ._request_builders import build_get_invalid_unix_time_request +from ._request_builders import build_get_null_unix_time_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py index ffa24bc5800..2a5b438a90b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null Int value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_request(**kwargs: Any) -> HttpRequest: """Get invalid Int value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -68,26 +56,18 @@ def build_get_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_overflow_int32_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_overflow_int32_request(**kwargs: Any) -> HttpRequest: """Get overflow Int32 value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -101,26 +81,18 @@ def build_get_overflow_int32_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/overflowint32" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_underflow_int32_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_underflow_int32_request(**kwargs: Any) -> HttpRequest: """Get underflow Int32 value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -134,26 +106,18 @@ def build_get_underflow_int32_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/underflowint32" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_overflow_int64_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_overflow_int64_request(**kwargs: Any) -> HttpRequest: """Get overflow Int64 value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -167,26 +131,18 @@ def build_get_overflow_int64_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/overflowint64" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_underflow_int64_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_underflow_int64_request(**kwargs: Any) -> HttpRequest: """Get underflow Int64 value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -200,26 +156,18 @@ def build_get_underflow_int64_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/underflowint64" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_max32_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_max32_request(*, json: int, **kwargs: Any) -> HttpRequest: """Put max int32 value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -235,29 +183,21 @@ def build_put_max32_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/max/32" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_put_max64_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_max64_request(*, json: int, **kwargs: Any) -> HttpRequest: """Put max int64 value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -273,29 +213,21 @@ def build_put_max64_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/max/64" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_put_min32_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_min32_request(*, json: int, **kwargs: Any) -> HttpRequest: """Put min int32 value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -311,29 +243,21 @@ def build_put_min32_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/min/32" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_put_min64_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_min64_request(*, json: int, **kwargs: Any) -> HttpRequest: """Put min int64 value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -349,29 +273,21 @@ def build_put_min64_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/min/64" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_unix_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_unix_time_request(**kwargs: Any) -> HttpRequest: """Get datetime encoded as Unix time value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -385,26 +301,18 @@ def build_get_unix_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/unixtime" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_unix_time_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_unix_time_date_request(*, json: datetime.datetime, **kwargs: Any) -> HttpRequest: """Put datetime encoded as Unix time. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -420,29 +328,21 @@ def build_put_unix_time_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/unixtime" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_invalid_unix_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_unix_time_request(**kwargs: Any) -> HttpRequest: """Get invalid Unix time value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -456,26 +356,18 @@ def build_get_invalid_unix_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/invalidunixtime" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_null_unix_time_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_unix_time_request(**kwargs: Any) -> HttpRequest: """Get null Unix time value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -489,17 +381,12 @@ def build_get_null_unix_time_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/int/nullunixtime" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py deleted file mode 100644 index 4464859b6e9..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyIntegerLowLevel/bodyintegerlowlevel/rest/int/_request_builders_py3.py +++ /dev/null @@ -1,506 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null Int value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid Int value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_overflow_int32_request( - **kwargs: Any -) -> HttpRequest: - """Get overflow Int32 value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/overflowint32" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_underflow_int32_request( - **kwargs: Any -) -> HttpRequest: - """Get underflow Int32 value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/underflowint32" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_overflow_int64_request( - **kwargs: Any -) -> HttpRequest: - """Get overflow Int64 value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/overflowint64" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_underflow_int64_request( - **kwargs: Any -) -> HttpRequest: - """Get underflow Int64 value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/underflowint64" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_max32_request( - *, - json: int, - **kwargs: Any -) -> HttpRequest: - """Put max int32 value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: int body. Required. - :paramtype json: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/max/32" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_put_max64_request( - *, - json: int, - **kwargs: Any -) -> HttpRequest: - """Put max int64 value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: int body. Required. - :paramtype json: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/max/64" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_put_min32_request( - *, - json: int, - **kwargs: Any -) -> HttpRequest: - """Put min int32 value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: int body. Required. - :paramtype json: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/min/32" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_put_min64_request( - *, - json: int, - **kwargs: Any -) -> HttpRequest: - """Put min int64 value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: int body. Required. - :paramtype json: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/min/64" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_unix_time_request( - **kwargs: Any -) -> HttpRequest: - """Get datetime encoded as Unix time value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/unixtime" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_unix_time_date_request( - *, - json: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Put datetime encoded as Unix time. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: int body. Required. - :paramtype json: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/unixtime" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_invalid_unix_time_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid Unix time value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/invalidunixtime" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_null_unix_time_request( - **kwargs: Any -) -> HttpRequest: - """Get null Unix time value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/int/nullunixtime" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_client.py index 31bb241f7fe..7ebbf2e4fcf 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-k """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestNumberTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/__init__.py index cce808da949..b658424d6e8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/__init__.py @@ -6,56 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_get_invalid_float_request - from ._request_builders_py3 import build_get_invalid_double_request - from ._request_builders_py3 import build_get_invalid_decimal_request - from ._request_builders_py3 import build_put_big_float_request - from ._request_builders_py3 import build_get_big_float_request - from ._request_builders_py3 import build_put_big_double_request - from ._request_builders_py3 import build_get_big_double_request - from ._request_builders_py3 import build_put_big_double_positive_decimal_request - from ._request_builders_py3 import build_get_big_double_positive_decimal_request - from ._request_builders_py3 import build_put_big_double_negative_decimal_request - from ._request_builders_py3 import build_get_big_double_negative_decimal_request - from ._request_builders_py3 import build_put_big_decimal_request - from ._request_builders_py3 import build_get_big_decimal_request - from ._request_builders_py3 import build_put_big_decimal_positive_decimal_request - from ._request_builders_py3 import build_get_big_decimal_positive_decimal_request - from ._request_builders_py3 import build_put_big_decimal_negative_decimal_request - from ._request_builders_py3 import build_get_big_decimal_negative_decimal_request - from ._request_builders_py3 import build_put_small_float_request - from ._request_builders_py3 import build_get_small_float_request - from ._request_builders_py3 import build_put_small_double_request - from ._request_builders_py3 import build_get_small_double_request - from ._request_builders_py3 import build_put_small_decimal_request - from ._request_builders_py3 import build_get_small_decimal_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_get_invalid_float_request # type: ignore - from ._request_builders import build_get_invalid_double_request # type: ignore - from ._request_builders import build_get_invalid_decimal_request # type: ignore - from ._request_builders import build_put_big_float_request # type: ignore - from ._request_builders import build_get_big_float_request # type: ignore - from ._request_builders import build_put_big_double_request # type: ignore - from ._request_builders import build_get_big_double_request # type: ignore - from ._request_builders import build_put_big_double_positive_decimal_request # type: ignore - from ._request_builders import build_get_big_double_positive_decimal_request # type: ignore - from ._request_builders import build_put_big_double_negative_decimal_request # type: ignore - from ._request_builders import build_get_big_double_negative_decimal_request # type: ignore - from ._request_builders import build_put_big_decimal_request # type: ignore - from ._request_builders import build_get_big_decimal_request # type: ignore - from ._request_builders import build_put_big_decimal_positive_decimal_request # type: ignore - from ._request_builders import build_get_big_decimal_positive_decimal_request # type: ignore - from ._request_builders import build_put_big_decimal_negative_decimal_request # type: ignore - from ._request_builders import build_get_big_decimal_negative_decimal_request # type: ignore - from ._request_builders import build_put_small_float_request # type: ignore - from ._request_builders import build_get_small_float_request # type: ignore - from ._request_builders import build_put_small_double_request # type: ignore - from ._request_builders import build_get_small_double_request # type: ignore - from ._request_builders import build_put_small_decimal_request # type: ignore - from ._request_builders import build_get_small_decimal_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_get_invalid_float_request +from ._request_builders import build_get_invalid_double_request +from ._request_builders import build_get_invalid_decimal_request +from ._request_builders import build_put_big_float_request +from ._request_builders import build_get_big_float_request +from ._request_builders import build_put_big_double_request +from ._request_builders import build_get_big_double_request +from ._request_builders import build_put_big_double_positive_decimal_request +from ._request_builders import build_get_big_double_positive_decimal_request +from ._request_builders import build_put_big_double_negative_decimal_request +from ._request_builders import build_get_big_double_negative_decimal_request +from ._request_builders import build_put_big_decimal_request +from ._request_builders import build_get_big_decimal_request +from ._request_builders import build_put_big_decimal_positive_decimal_request +from ._request_builders import build_get_big_decimal_positive_decimal_request +from ._request_builders import build_put_big_decimal_negative_decimal_request +from ._request_builders import build_get_big_decimal_negative_decimal_request +from ._request_builders import build_put_small_float_request +from ._request_builders import build_get_small_float_request +from ._request_builders import build_put_small_double_request +from ._request_builders import build_get_small_double_request +from ._request_builders import build_put_small_decimal_request +from ._request_builders import build_get_small_decimal_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py index 89eb478e628..35a8f839205 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null Number value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_float_request(**kwargs: Any) -> HttpRequest: """Get invalid float Number value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get_invalid_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/invalidfloat" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_double_request(**kwargs: Any) -> HttpRequest: """Get invalid double Number value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,26 +80,18 @@ def build_get_invalid_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/invaliddouble" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_invalid_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_invalid_decimal_request(**kwargs: Any) -> HttpRequest: """Get invalid decimal Number value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -133,26 +105,18 @@ def build_get_invalid_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/invaliddecimal" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_big_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_big_float_request(*, json: float, **kwargs: Any) -> HttpRequest: """Put big float value 3.402823e+20. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -168,29 +132,21 @@ def build_put_big_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/float/3.402823e+20" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_big_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_big_float_request(**kwargs: Any) -> HttpRequest: """Get big float value 3.402823e+20. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -204,26 +160,18 @@ def build_get_big_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/float/3.402823e+20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_big_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_big_double_request(*, json: float, **kwargs: Any) -> HttpRequest: """Put big double value 2.5976931e+101. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -239,29 +187,21 @@ def build_put_big_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/double/2.5976931e+101" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_big_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_big_double_request(**kwargs: Any) -> HttpRequest: """Get big double value 2.5976931e+101. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -275,26 +215,18 @@ def build_get_big_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/double/2.5976931e+101" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_big_double_positive_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_big_double_positive_decimal_request(**kwargs: Any) -> HttpRequest: """Put big double value 99999999.99. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -311,31 +243,22 @@ def build_put_big_double_positive_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', 99999999.99) # type: float - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + json = kwargs.pop("json", 99999999.99) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/double/99999999.99" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_double_positive_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_big_double_positive_decimal_request(**kwargs: Any) -> HttpRequest: """Get big double value 99999999.99. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -349,26 +272,18 @@ def build_get_big_double_positive_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/double/99999999.99" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_big_double_negative_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: """Put big double value -99999999.99. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -385,31 +300,22 @@ def build_put_big_double_negative_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', -99999999.99) # type: float - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + json = kwargs.pop("json", -99999999.99) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/double/-99999999.99" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_double_negative_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_big_double_negative_decimal_request(**kwargs: Any) -> HttpRequest: """Get big double value -99999999.99. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -423,26 +329,18 @@ def build_get_big_double_negative_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/double/-99999999.99" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_big_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_big_decimal_request(*, json: float, **kwargs: Any) -> HttpRequest: """Put big decimal value 2.5976931e+101. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -458,29 +356,21 @@ def build_put_big_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/decimal/2.5976931e+101" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_big_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_big_decimal_request(**kwargs: Any) -> HttpRequest: """Get big decimal value 2.5976931e+101. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -494,26 +384,18 @@ def build_get_big_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/decimal/2.5976931e+101" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_big_decimal_positive_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_big_decimal_positive_decimal_request(**kwargs: Any) -> HttpRequest: """Put big decimal value 99999999.99. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -530,31 +412,22 @@ def build_put_big_decimal_positive_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', 99999999.99) # type: float - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + json = kwargs.pop("json", 99999999.99) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/decimal/99999999.99" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_decimal_positive_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_big_decimal_positive_decimal_request(**kwargs: Any) -> HttpRequest: """Get big decimal value 99999999.99. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -568,26 +441,18 @@ def build_get_big_decimal_positive_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/decimal/99999999.99" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_big_decimal_negative_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest: """Put big decimal value -99999999.99. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -604,31 +469,22 @@ def build_put_big_decimal_negative_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', -99999999.99) # type: float - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + json = kwargs.pop("json", -99999999.99) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/decimal/-99999999.99" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_decimal_negative_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_big_decimal_negative_decimal_request(**kwargs: Any) -> HttpRequest: """Get big decimal value -99999999.99. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -642,26 +498,18 @@ def build_get_big_decimal_negative_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/big/decimal/-99999999.99" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_small_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_small_float_request(*, json: float, **kwargs: Any) -> HttpRequest: """Put small float value 3.402823e-20. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -677,29 +525,21 @@ def build_put_small_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/small/float/3.402823e-20" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_small_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_small_float_request(**kwargs: Any) -> HttpRequest: """Get big double value 3.402823e-20. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -713,26 +553,18 @@ def build_get_small_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/small/float/3.402823e-20" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_small_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_small_double_request(*, json: float, **kwargs: Any) -> HttpRequest: """Put small double value 2.5976931e-101. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -748,29 +580,21 @@ def build_put_small_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/small/double/2.5976931e-101" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_small_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_small_double_request(**kwargs: Any) -> HttpRequest: """Get big double value 2.5976931e-101. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -784,26 +608,18 @@ def build_get_small_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/small/double/2.5976931e-101" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_small_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_small_decimal_request(*, json: float, **kwargs: Any) -> HttpRequest: """Put small decimal value 2.5976931e-101. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -819,29 +635,21 @@ def build_put_small_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/small/decimal/2.5976931e-101" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_small_decimal_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_small_decimal_request(**kwargs: Any) -> HttpRequest: """Get small decimal value 2.5976931e-101. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -855,17 +663,12 @@ def build_get_small_decimal_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/number/small/decimal/2.5976931e-101" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py deleted file mode 100644 index 9371a88ee8c..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyNumberLowLevel/bodynumberlowlevel/rest/number/_request_builders_py3.py +++ /dev/null @@ -1,865 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null Number value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_float_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid float Number value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/invalidfloat" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_double_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid double Number value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/invaliddouble" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_invalid_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Get invalid decimal Number value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/invaliddecimal" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_big_float_request( - *, - json: float, - **kwargs: Any -) -> HttpRequest: - """Put big float value 3.402823e+20. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: number body. Required. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/float/3.402823e+20" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_float_request( - **kwargs: Any -) -> HttpRequest: - """Get big float value 3.402823e+20. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/float/3.402823e+20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_big_double_request( - *, - json: float, - **kwargs: Any -) -> HttpRequest: - """Put big double value 2.5976931e+101. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: number body. Required. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/double/2.5976931e+101" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_double_request( - **kwargs: Any -) -> HttpRequest: - """Get big double value 2.5976931e+101. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/double/2.5976931e+101" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_big_double_positive_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Put big double value 99999999.99. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Default value is 99999999.99. Note that overriding this default value may result - in unsupported behavior. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', 99999999.99) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/double/99999999.99" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_double_positive_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Get big double value 99999999.99. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/double/99999999.99" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_big_double_negative_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Put big double value -99999999.99. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Default value is -99999999.99. Note that overriding this default value may - result in unsupported behavior. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', -99999999.99) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/double/-99999999.99" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_double_negative_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Get big double value -99999999.99. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/double/-99999999.99" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_big_decimal_request( - *, - json: float, - **kwargs: Any -) -> HttpRequest: - """Put big decimal value 2.5976931e+101. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: number body. Required. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/decimal/2.5976931e+101" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Get big decimal value 2.5976931e+101. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/decimal/2.5976931e+101" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_big_decimal_positive_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Put big decimal value 99999999.99. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Default value is 99999999.99. Note that overriding this default value may result - in unsupported behavior. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', 99999999.99) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/decimal/99999999.99" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_decimal_positive_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Get big decimal value 99999999.99. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/decimal/99999999.99" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_big_decimal_negative_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Put big decimal value -99999999.99. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Default value is -99999999.99. Note that overriding this default value may - result in unsupported behavior. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', -99999999.99) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/decimal/-99999999.99" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_big_decimal_negative_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Get big decimal value -99999999.99. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/big/decimal/-99999999.99" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_small_float_request( - *, - json: float, - **kwargs: Any -) -> HttpRequest: - """Put small float value 3.402823e-20. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: number body. Required. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/small/float/3.402823e-20" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_small_float_request( - **kwargs: Any -) -> HttpRequest: - """Get big double value 3.402823e-20. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/small/float/3.402823e-20" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_small_double_request( - *, - json: float, - **kwargs: Any -) -> HttpRequest: - """Put small double value 2.5976931e-101. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: number body. Required. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/small/double/2.5976931e-101" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_small_double_request( - **kwargs: Any -) -> HttpRequest: - """Get big double value 2.5976931e-101. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/small/double/2.5976931e-101" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_small_decimal_request( - *, - json: float, - **kwargs: Any -) -> HttpRequest: - """Put small decimal value 2.5976931e-101. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: number body. Required. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/small/decimal/2.5976931e-101" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_small_decimal_request( - **kwargs: Any -) -> HttpRequest: - """Get small decimal value 2.5976931e-101. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/number/small/decimal/2.5976931e-101" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_client.py index 2c35a531266..5396fdf7408 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-k """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/__init__.py index b47975af01f..ec2a8a0642c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/__init__.py @@ -6,20 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_not_expandable_request - from ._request_builders_py3 import build_put_not_expandable_request - from ._request_builders_py3 import build_get_referenced_request - from ._request_builders_py3 import build_put_referenced_request - from ._request_builders_py3 import build_get_referenced_constant_request - from ._request_builders_py3 import build_put_referenced_constant_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_not_expandable_request # type: ignore - from ._request_builders import build_put_not_expandable_request # type: ignore - from ._request_builders import build_get_referenced_request # type: ignore - from ._request_builders import build_put_referenced_request # type: ignore - from ._request_builders import build_get_referenced_constant_request # type: ignore - from ._request_builders import build_put_referenced_constant_request # type: ignore +from ._request_builders import build_get_not_expandable_request +from ._request_builders import build_put_not_expandable_request +from ._request_builders import build_get_referenced_request +from ._request_builders import build_put_referenced_request +from ._request_builders import build_get_referenced_constant_request +from ._request_builders import build_put_referenced_constant_request __all__ = [ "build_get_not_expandable_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py index 53927435524..556e5a91784 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_not_expandable_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_not_expandable_request(**kwargs: Any) -> HttpRequest: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,26 +37,18 @@ def build_get_not_expandable_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/enum/notExpandable" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_not_expandable_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_not_expandable_request(*, json: str, **kwargs: Any) -> HttpRequest: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -77,29 +65,21 @@ def build_put_not_expandable_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/enum/notExpandable" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_referenced_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_referenced_request(**kwargs: Any) -> HttpRequest: """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -113,26 +93,18 @@ def build_get_referenced_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/enum/Referenced" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_referenced_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_referenced_request(*, json: str, **kwargs: Any) -> HttpRequest: """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -149,29 +121,21 @@ def build_put_referenced_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/enum/Referenced" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_referenced_constant_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_referenced_constant_request(**kwargs: Any) -> HttpRequest: """Get value 'green-color' from the constant. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -185,27 +149,21 @@ def build_get_referenced_constant_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/enum/ReferencedConstant" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_referenced_constant_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Sends value 'green-color' from a constant. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -235,9 +193,8 @@ def build_put_referenced_constant_request( @overload def build_put_referenced_constant_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Sends value 'green-color' from a constant. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -255,10 +212,7 @@ def build_put_referenced_constant_request( """ -def build_put_referenced_constant_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_referenced_constant_request(**kwargs: Any) -> HttpRequest: """Sends value 'green-color' from a constant. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -277,20 +231,15 @@ def build_put_referenced_constant_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/enum/ReferencedConstant" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py deleted file mode 100644 index b39280de1b5..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/enum/_request_builders_py3.py +++ /dev/null @@ -1,300 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_not_expandable_request( - **kwargs: Any -) -> HttpRequest: - """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/enum/notExpandable" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_not_expandable_request( - *, - json: str, - **kwargs: Any -) -> HttpRequest: - """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: string body. Known values are: "red color", "green-color", and "blue_color". - Required. - :paramtype json: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/enum/notExpandable" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_referenced_request( - **kwargs: Any -) -> HttpRequest: - """Get enum value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/enum/Referenced" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_referenced_request( - *, - json: str, - **kwargs: Any -) -> HttpRequest: - """Sends value 'red color' from enumeration of 'red color', 'green-color', 'blue_color'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: enum string body. Known values are: "red color", "green-color", and - "blue_color". Required. - :paramtype json: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/enum/Referenced" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_referenced_constant_request( - **kwargs: Any -) -> HttpRequest: - """Get value 'green-color' from the constant. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/enum/ReferencedConstant" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_referenced_constant_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Sends value 'green-color' from a constant. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: enum string body. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "ColorConstant": "green-color", # Default value is "green-color". Referenced - Color Constant Description. Required. - "field1": "str" # Optional. Sample string. - } - """ - - -@overload -def build_put_referenced_constant_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Sends value 'green-color' from a constant. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: enum string body. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_referenced_constant_request( - **kwargs: Any -) -> HttpRequest: - """Sends value 'green-color' from a constant. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: enum string body. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/enum/ReferencedConstant" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/__init__.py index 9ace38ded20..a204e22cefd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/__init__.py @@ -6,34 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_null_request - from ._request_builders_py3 import build_put_null_request - from ._request_builders_py3 import build_get_empty_request - from ._request_builders_py3 import build_put_empty_request - from ._request_builders_py3 import build_get_mbcs_request - from ._request_builders_py3 import build_put_mbcs_request - from ._request_builders_py3 import build_get_whitespace_request - from ._request_builders_py3 import build_put_whitespace_request - from ._request_builders_py3 import build_get_not_provided_request - from ._request_builders_py3 import build_get_base64_encoded_request - from ._request_builders_py3 import build_get_base64_url_encoded_request - from ._request_builders_py3 import build_put_base64_url_encoded_request - from ._request_builders_py3 import build_get_null_base64_url_encoded_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_null_request # type: ignore - from ._request_builders import build_put_null_request # type: ignore - from ._request_builders import build_get_empty_request # type: ignore - from ._request_builders import build_put_empty_request # type: ignore - from ._request_builders import build_get_mbcs_request # type: ignore - from ._request_builders import build_put_mbcs_request # type: ignore - from ._request_builders import build_get_whitespace_request # type: ignore - from ._request_builders import build_put_whitespace_request # type: ignore - from ._request_builders import build_get_not_provided_request # type: ignore - from ._request_builders import build_get_base64_encoded_request # type: ignore - from ._request_builders import build_get_base64_url_encoded_request # type: ignore - from ._request_builders import build_put_base64_url_encoded_request # type: ignore - from ._request_builders import build_get_null_base64_url_encoded_request # type: ignore +from ._request_builders import build_get_null_request +from ._request_builders import build_put_null_request +from ._request_builders import build_get_empty_request +from ._request_builders import build_put_empty_request +from ._request_builders import build_get_mbcs_request +from ._request_builders import build_put_mbcs_request +from ._request_builders import build_get_whitespace_request +from ._request_builders import build_put_whitespace_request +from ._request_builders import build_get_not_provided_request +from ._request_builders import build_get_base64_encoded_request +from ._request_builders import build_get_base64_url_encoded_request +from ._request_builders import build_put_base64_url_encoded_request +from ._request_builders import build_get_null_base64_url_encoded_request __all__ = [ "build_get_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py index 0f7524db1be..398cc27a6b6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_request(**kwargs: Any) -> HttpRequest: """Get null string value value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_get_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/null" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_null_request(*, content: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Set string value null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -69,29 +57,21 @@ def build_put_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/null" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get empty string value value ''. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -105,26 +85,18 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_request(**kwargs: Any) -> HttpRequest: """Set string value empty ''. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -141,31 +113,22 @@ def build_put_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - json = kwargs.pop('json', "") # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + json = kwargs.pop("json", "") # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/empty" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_mbcs_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_mbcs_request(**kwargs: Any) -> HttpRequest: """Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -179,26 +142,18 @@ def build_get_mbcs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/mbcs" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_mbcs_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_mbcs_request(**kwargs: Any) -> HttpRequest: """Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -216,31 +171,22 @@ def build_put_mbcs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + json = kwargs.pop("json", "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/mbcs" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_whitespace_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_whitespace_request(**kwargs: Any) -> HttpRequest: """Get string value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -256,26 +202,18 @@ def build_get_whitespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/whitespace" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_whitespace_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_whitespace_request(**kwargs: Any) -> HttpRequest: """Set String value with leading and trailing whitespace ':code:``:code:``:code:``Now is the time for all good men to come to the aid of their country:code:``:code:``:code:``'. @@ -295,31 +233,24 @@ def build_put_whitespace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', " Now is the time for all good men to come to the aid of their country ") # type: str - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + json = kwargs.pop( + "json", " Now is the time for all good men to come to the aid of their country " + ) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/whitespace" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_not_provided_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) + + +def build_get_not_provided_request(**kwargs: Any) -> HttpRequest: """Get String value when no string value is sent in response payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -333,26 +264,18 @@ def build_get_not_provided_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/notProvided" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_base64_encoded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_base64_encoded_request(**kwargs: Any) -> HttpRequest: """Get value that is base64 encoded. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -366,26 +289,18 @@ def build_get_base64_encoded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/base64Encoding" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_base64_url_encoded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: """Get value that is base64url encoded. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -399,26 +314,18 @@ def build_get_base64_url_encoded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/base64UrlEncoding" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_base64_url_encoded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_base64_url_encoded_request(*, json: bytes, **kwargs: Any) -> HttpRequest: """Put value that is base64url encoded. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -434,29 +341,21 @@ def build_put_base64_url_encoded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/base64UrlEncoding" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_null_base64_url_encoded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_null_base64_url_encoded_request(**kwargs: Any) -> HttpRequest: """Get null value that is expected to be base64url encoded. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -470,17 +369,12 @@ def build_get_null_base64_url_encoded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/string/nullBase64UrlEncoding" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py deleted file mode 100644 index 8bf05c04f87..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyStringLowLevel/bodystringlowlevel/rest/string/_request_builders_py3.py +++ /dev/null @@ -1,479 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_null_request( - **kwargs: Any -) -> HttpRequest: - """Get null string value value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/null" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_null_request( - *, - content: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Set string value null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: string body. Default value is None. - :paramtype content: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/null" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get empty string value value ''. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_empty_request( - **kwargs: Any -) -> HttpRequest: - """Set string value empty ''. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: string body. Required. Default value is "". Note that overriding this default - value may result in unsupported behavior. - :paramtype json: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - json = kwargs.pop('json', "") # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/empty" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_mbcs_request( - **kwargs: Any -) -> HttpRequest: - """Get mbcs string value '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/mbcs" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_mbcs_request( - **kwargs: Any -) -> HttpRequest: - """Set string value mbcs '啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: string body. Default value is - "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€". Note that overriding - this default value may result in unsupported behavior. - :paramtype json: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', "啊齄丂狛狜隣郎隣兀﨩ˊ〞〡¦℡㈱‐ー﹡﹢﹫、〓ⅰⅹ⒈€㈠㈩ⅠⅫ! ̄ぁんァヶΑ︴АЯаяāɡㄅㄩ─╋︵﹄︻︱︳︴ⅰⅹɑɡ〇〾⿻⺁䜣€") # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/mbcs" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_whitespace_request( - **kwargs: Any -) -> HttpRequest: - """Get string value with leading and trailing whitespace - ':code:``:code:``:code:``Now is the time for all good men to come to the aid - of their country:code:``:code:``:code:``'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/whitespace" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_whitespace_request( - **kwargs: Any -) -> HttpRequest: - """Set String value with leading and trailing whitespace - ':code:``:code:``:code:``Now is the time for all good men to come to the aid - of their country:code:``:code:``:code:``'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: string body. Default value is " Now is the time for all good men to come to - the aid of their country ". Note that overriding this default value may result in - unsupported behavior. - :paramtype json: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - json = kwargs.pop('json', " Now is the time for all good men to come to the aid of their country ") # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/whitespace" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_not_provided_request( - **kwargs: Any -) -> HttpRequest: - """Get String value when no string value is sent in response payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/notProvided" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_base64_encoded_request( - **kwargs: Any -) -> HttpRequest: - """Get value that is base64 encoded. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/base64Encoding" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_base64_url_encoded_request( - **kwargs: Any -) -> HttpRequest: - """Get value that is base64url encoded. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/base64UrlEncoding" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_base64_url_encoded_request( - *, - json: bytes, - **kwargs: Any -) -> HttpRequest: - """Put value that is base64url encoded. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: string body. Required. - :paramtype json: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/base64UrlEncoding" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_null_base64_url_encoded_request( - **kwargs: Any -) -> HttpRequest: - """Get null value that is expected to be base64url encoded. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/string/nullBase64UrlEncoding" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_client.py index 3b13498d322..d8e87be7c30 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-key """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/__init__.py index 355267c5498..5c0124f9ae3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_request - from ._request_builders_py3 import build_put_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_request # type: ignore - from ._request_builders import build_put_request # type: ignore +from ._request_builders import build_get_request +from ._request_builders import build_put_request __all__ = [ "build_get_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py index 4a41b210c02..ae52ed2e547 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_request(**kwargs: Any) -> HttpRequest: """Get time value "11:34:56". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -35,26 +31,18 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/time/get" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_request(*, json: datetime.time, **kwargs: Any) -> HttpRequest: """Put time value "08:07:56". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -70,20 +58,15 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/time/put" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py deleted file mode 100644 index 821be1b26cd..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/BodyTimeLowLevel/bodytimelowlevel/rest/time/_request_builders_py3.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_request( - **kwargs: Any -) -> HttpRequest: - """Get time value "11:34:56". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/time/get" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_request( - *, - json: datetime.time, - **kwargs: Any -) -> HttpRequest: - """Put time value "08:07:56". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put time value "08:07:56" in parameter to pass testserver. Required. - :paramtype json: ~datetime.time - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/time/put" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_client.py index d786cfca951..e0c84908614 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/_client.py @@ -40,7 +40,6 @@ class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-vers """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerConstantServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/__init__.py index 3d9ad535b0e..478e47091eb 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/__init__.py @@ -6,42 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put_no_model_as_string_no_required_two_value_no_default_request - from ._request_builders_py3 import build_put_no_model_as_string_no_required_two_value_default_request - from ._request_builders_py3 import build_put_no_model_as_string_no_required_one_value_no_default_request - from ._request_builders_py3 import build_put_no_model_as_string_no_required_one_value_default_request - from ._request_builders_py3 import build_put_no_model_as_string_required_two_value_no_default_request - from ._request_builders_py3 import build_put_no_model_as_string_required_two_value_default_request - from ._request_builders_py3 import build_put_no_model_as_string_required_one_value_no_default_request - from ._request_builders_py3 import build_put_no_model_as_string_required_one_value_default_request - from ._request_builders_py3 import build_put_model_as_string_no_required_two_value_no_default_request - from ._request_builders_py3 import build_put_model_as_string_no_required_two_value_default_request - from ._request_builders_py3 import build_put_model_as_string_no_required_one_value_no_default_request - from ._request_builders_py3 import build_put_model_as_string_no_required_one_value_default_request - from ._request_builders_py3 import build_put_model_as_string_required_two_value_no_default_request - from ._request_builders_py3 import build_put_model_as_string_required_two_value_default_request - from ._request_builders_py3 import build_put_model_as_string_required_one_value_no_default_request - from ._request_builders_py3 import build_put_model_as_string_required_one_value_default_request - from ._request_builders_py3 import build_put_client_constants_request -except (SyntaxError, ImportError): - from ._request_builders import build_put_no_model_as_string_no_required_two_value_no_default_request # type: ignore - from ._request_builders import build_put_no_model_as_string_no_required_two_value_default_request # type: ignore - from ._request_builders import build_put_no_model_as_string_no_required_one_value_no_default_request # type: ignore - from ._request_builders import build_put_no_model_as_string_no_required_one_value_default_request # type: ignore - from ._request_builders import build_put_no_model_as_string_required_two_value_no_default_request # type: ignore - from ._request_builders import build_put_no_model_as_string_required_two_value_default_request # type: ignore - from ._request_builders import build_put_no_model_as_string_required_one_value_no_default_request # type: ignore - from ._request_builders import build_put_no_model_as_string_required_one_value_default_request # type: ignore - from ._request_builders import build_put_model_as_string_no_required_two_value_no_default_request # type: ignore - from ._request_builders import build_put_model_as_string_no_required_two_value_default_request # type: ignore - from ._request_builders import build_put_model_as_string_no_required_one_value_no_default_request # type: ignore - from ._request_builders import build_put_model_as_string_no_required_one_value_default_request # type: ignore - from ._request_builders import build_put_model_as_string_required_two_value_no_default_request # type: ignore - from ._request_builders import build_put_model_as_string_required_two_value_default_request # type: ignore - from ._request_builders import build_put_model_as_string_required_one_value_no_default_request # type: ignore - from ._request_builders import build_put_model_as_string_required_one_value_default_request # type: ignore - from ._request_builders import build_put_client_constants_request # type: ignore +from ._request_builders import build_put_no_model_as_string_no_required_two_value_no_default_request +from ._request_builders import build_put_no_model_as_string_no_required_two_value_default_request +from ._request_builders import build_put_no_model_as_string_no_required_one_value_no_default_request +from ._request_builders import build_put_no_model_as_string_no_required_one_value_default_request +from ._request_builders import build_put_no_model_as_string_required_two_value_no_default_request +from ._request_builders import build_put_no_model_as_string_required_two_value_default_request +from ._request_builders import build_put_no_model_as_string_required_one_value_no_default_request +from ._request_builders import build_put_no_model_as_string_required_one_value_default_request +from ._request_builders import build_put_model_as_string_no_required_two_value_no_default_request +from ._request_builders import build_put_model_as_string_no_required_two_value_default_request +from ._request_builders import build_put_model_as_string_no_required_one_value_no_default_request +from ._request_builders import build_put_model_as_string_no_required_one_value_default_request +from ._request_builders import build_put_model_as_string_required_two_value_no_default_request +from ._request_builders import build_put_model_as_string_required_two_value_default_request +from ._request_builders import build_put_model_as_string_required_one_value_no_default_request +from ._request_builders import build_put_model_as_string_required_one_value_default_request +from ._request_builders import build_put_client_constants_request __all__ = [ "build_put_no_model_as_string_no_required_two_value_no_default_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders.py index 7074fdbad43..8bc6db7bfed 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders.py @@ -16,12 +16,10 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_put_no_model_as_string_no_required_two_value_no_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -39,26 +37,19 @@ def build_put_no_model_as_string_no_required_two_value_no_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', None)) # type: Optional[str] # Construct URL _url = "/constants/putNoModelAsStringNoRequiredTwoValueNoDefault" # Construct parameters if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_no_model_as_string_no_required_two_value_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: str = "value1", **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -76,26 +67,19 @@ def build_put_no_model_as_string_no_required_two_value_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str # Construct URL _url = "/constants/putNoModelAsStringNoRequiredTwoValueDefault" # Construct parameters if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_no_model_as_string_no_required_one_value_no_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: str = "value1", **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -113,26 +97,19 @@ def build_put_no_model_as_string_no_required_one_value_no_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str # Construct URL _url = "/constants/putNoModelAsStringNoRequiredOneValueNoDefault" # Construct parameters if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_no_model_as_string_no_required_one_value_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: str = "value1", **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -150,26 +127,17 @@ def build_put_no_model_as_string_no_required_one_value_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str # Construct URL _url = "/constants/putNoModelAsStringNoRequiredOneValueDefault" # Construct parameters if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) -def build_put_no_model_as_string_required_two_value_no_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_no_model_as_string_required_two_value_no_default_request(*, input: str, **kwargs: Any) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -187,25 +155,18 @@ def build_put_no_model_as_string_required_two_value_no_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input') # type: str # Construct URL _url = "/constants/putNoModelAsStringRequiredTwoValueNoDefault" # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_no_model_as_string_required_two_value_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: str = "value1", **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -223,25 +184,16 @@ def build_put_no_model_as_string_required_two_value_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str # Construct URL _url = "/constants/putNoModelAsStringRequiredTwoValueDefault" # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) -def build_put_no_model_as_string_required_one_value_no_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_no_model_as_string_required_one_value_no_default_request(**kwargs: Any) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -260,25 +212,17 @@ def build_put_no_model_as_string_required_one_value_no_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str + input = kwargs.pop("input", _params.pop("input", "value1")) # type: str # Construct URL _url = "/constants/putNoModelAsStringRequiredOneValueNoDefault" # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) -def build_put_no_model_as_string_required_one_value_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_no_model_as_string_required_one_value_default_request(**kwargs: Any) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -297,25 +241,19 @@ def build_put_no_model_as_string_required_one_value_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str + input = kwargs.pop("input", _params.pop("input", "value1")) # type: str # Construct URL _url = "/constants/putNoModelAsStringRequiredOneValueDefault" # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_model_as_string_no_required_two_value_no_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -333,26 +271,19 @@ def build_put_model_as_string_no_required_two_value_no_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', None)) # type: Optional[str] # Construct URL _url = "/constants/putModelAsStringNoRequiredTwoValueNoDefault" # Construct parameters if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_model_as_string_no_required_two_value_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: str = "value1", **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -370,26 +301,19 @@ def build_put_model_as_string_no_required_two_value_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str # Construct URL _url = "/constants/putModelAsStringNoRequiredTwoValueDefault" # Construct parameters if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_model_as_string_no_required_one_value_no_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -407,26 +331,19 @@ def build_put_model_as_string_no_required_one_value_no_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', None)) # type: Optional[str] # Construct URL _url = "/constants/putModelAsStringNoRequiredOneValueNoDefault" # Construct parameters if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_model_as_string_no_required_one_value_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: str = "value1", **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -444,26 +361,17 @@ def build_put_model_as_string_no_required_one_value_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str # Construct URL _url = "/constants/putModelAsStringNoRequiredOneValueDefault" # Construct parameters if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) -def build_put_model_as_string_required_two_value_no_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_model_as_string_required_two_value_no_default_request(*, input: str, **kwargs: Any) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -481,25 +389,18 @@ def build_put_model_as_string_required_two_value_no_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input') # type: str # Construct URL _url = "/constants/putModelAsStringRequiredTwoValueNoDefault" # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_model_as_string_required_two_value_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: str = "value1", **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -517,25 +418,16 @@ def build_put_model_as_string_required_two_value_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str # Construct URL _url = "/constants/putModelAsStringRequiredTwoValueDefault" # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) -def build_put_model_as_string_required_one_value_no_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_model_as_string_required_one_value_no_default_request(*, input: str, **kwargs: Any) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -553,25 +445,18 @@ def build_put_model_as_string_required_one_value_no_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input') # type: str # Construct URL _url = "/constants/putModelAsStringRequiredOneValueNoDefault" # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) def build_put_model_as_string_required_one_value_default_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, input: str = "value1", **kwargs: Any +) -> HttpRequest: """Puts constants to the testserver. Puts constants to the testserver. @@ -589,25 +474,16 @@ def build_put_model_as_string_required_one_value_default_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str # Construct URL _url = "/constants/putModelAsStringRequiredOneValueDefault" # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') + _params["input"] = _SERIALIZER.query("input", input, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, **kwargs) -def build_put_client_constants_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_client_constants_request(**kwargs: Any) -> HttpRequest: """Pass constants from the client to this function. Will pass in constant path, query, and header parameters. @@ -635,27 +511,21 @@ def build_put_client_constants_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - header_constant = kwargs.pop('header_constant', _headers.pop('header-constant', True)) # type: bool - query_constant = kwargs.pop('query_constant', _params.pop('query-constant', 100)) # type: int - path_constant = kwargs.pop('path_constant', "path") # type: str + header_constant = kwargs.pop("header_constant", _headers.pop("header-constant", True)) # type: bool + query_constant = kwargs.pop("query_constant", _params.pop("query-constant", 100)) # type: int + path_constant = kwargs.pop("path_constant", "path") # type: str # Construct URL _url = "/constants/clientConstants/{path-constant}" path_format_arguments = { - "path-constant": _SERIALIZER.url("path_constant", path_constant, 'str'), + "path-constant": _SERIALIZER.url("path_constant", path_constant, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['query-constant'] = _SERIALIZER.query("query_constant", query_constant, 'int') + _params["query-constant"] = _SERIALIZER.query("query_constant", query_constant, "int") # Construct headers - _headers['header-constant'] = _SERIALIZER.header("header_constant", header_constant, 'bool') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["header-constant"] = _SERIALIZER.header("header_constant", header_constant, "bool") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders_py3.py deleted file mode 100644 index 44f2d464b5e..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ConstantsLowLevel/constantslowlevel/rest/contants/_request_builders_py3.py +++ /dev/null @@ -1,658 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_put_no_model_as_string_no_required_two_value_no_default_request( - *, - input: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are: "value1" and "value2". Default value is None. - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putNoModelAsStringNoRequiredTwoValueNoDefault" - - # Construct parameters - if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_no_model_as_string_no_required_two_value_default_request( - *, - input: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are: "value1" and "value2". Default value is "value1". - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putNoModelAsStringNoRequiredTwoValueDefault" - - # Construct parameters - if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_no_model_as_string_no_required_one_value_no_default_request( - *, - input: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are "value1" and None. Default value is "value1". - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putNoModelAsStringNoRequiredOneValueNoDefault" - - # Construct parameters - if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_no_model_as_string_no_required_one_value_default_request( - *, - input: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are "value1" and None. Default value is "value1". - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putNoModelAsStringNoRequiredOneValueDefault" - - # Construct parameters - if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_no_model_as_string_required_two_value_no_default_request( - *, - input: str, - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are: "value1" and "value2". Required. - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putNoModelAsStringRequiredTwoValueNoDefault" - - # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_no_model_as_string_required_two_value_default_request( - *, - input: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are: "value1" and "value2". Default value is "value1". - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putNoModelAsStringRequiredTwoValueDefault" - - # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_no_model_as_string_required_one_value_no_default_request( - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Default value is "value1". Note that overriding this default value may result - in unsupported behavior. - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str - # Construct URL - _url = "/constants/putNoModelAsStringRequiredOneValueNoDefault" - - # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_no_model_as_string_required_one_value_default_request( - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Default value is "value1". Note that overriding this default value may result - in unsupported behavior. - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - input = kwargs.pop('input', _params.pop('input', "value1")) # type: str - # Construct URL - _url = "/constants/putNoModelAsStringRequiredOneValueDefault" - - # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_model_as_string_no_required_two_value_no_default_request( - *, - input: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are: "value1" and "value2". Default value is None. - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putModelAsStringNoRequiredTwoValueNoDefault" - - # Construct parameters - if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_model_as_string_no_required_two_value_default_request( - *, - input: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are: "value1" and "value2". Default value is "value1". - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putModelAsStringNoRequiredTwoValueDefault" - - # Construct parameters - if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_model_as_string_no_required_one_value_no_default_request( - *, - input: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: "value1" Default value is None. - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putModelAsStringNoRequiredOneValueNoDefault" - - # Construct parameters - if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_model_as_string_no_required_one_value_default_request( - *, - input: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: "value1" Default value is "value1". - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putModelAsStringNoRequiredOneValueDefault" - - # Construct parameters - if input is not None: - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_model_as_string_required_two_value_no_default_request( - *, - input: str, - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are: "value1" and "value2". Required. - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putModelAsStringRequiredTwoValueNoDefault" - - # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_model_as_string_required_two_value_default_request( - *, - input: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: Known values are: "value1" and "value2". Default value is "value1". - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putModelAsStringRequiredTwoValueDefault" - - # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_model_as_string_required_one_value_no_default_request( - *, - input: str, - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: "value1" Required. - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putModelAsStringRequiredOneValueNoDefault" - - # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_model_as_string_required_one_value_default_request( - *, - input: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Puts constants to the testserver. - - Puts constants to the testserver. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword input: "value1" Default value is "value1". - :paramtype input: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/constants/putModelAsStringRequiredOneValueDefault" - - # Construct parameters - _params['input'] = _SERIALIZER.query("input", input, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - **kwargs - ) - - -def build_put_client_constants_request( - **kwargs: Any -) -> HttpRequest: - """Pass constants from the client to this function. Will pass in constant path, query, and header - parameters. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword header_constant: Constant header property on the client that is a required parameter - for operation 'constants_putClientConstants'. Default value is True. Note that overriding this - default value may result in unsupported behavior. - :paramtype header_constant: bool - :keyword query_constant: Constant query property on the client that is a required parameter for - operation 'constants_putClientConstants'. Default value is 100. Note that overriding this - default value may result in unsupported behavior. - :paramtype query_constant: int - :keyword path_constant: Constant path property on the client that is a required parameter for - operation 'constants_putClientConstants'. Default value is "path". Note that overriding this - default value may result in unsupported behavior. - :paramtype path_constant: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - header_constant = kwargs.pop('header_constant', _headers.pop('header-constant', True)) # type: bool - query_constant = kwargs.pop('query_constant', _params.pop('query-constant', 100)) # type: int - path_constant = kwargs.pop('path_constant', "path") # type: str - # Construct URL - _url = "/constants/clientConstants/{path-constant}" - path_format_arguments = { - "path-constant": _SERIALIZER.url("path_constant", path_constant, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['query-constant'] = _SERIALIZER.query("query_constant", query_constant, 'int') - - # Construct headers - _headers['header-constant'] = _SERIALIZER.header("header_constant", header_constant, 'bool') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py index 5daa0aa077d..b03437179b1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_empty_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_empty_request # type: ignore +from ._request_builders import build_get_empty_request __all__ = [ "build_get_empty_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py index 9ec0f524b4a..feca717c807 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_request(**kwargs: Any) -> HttpRequest: """Get a 200 to test a valid base uri. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,17 +30,12 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customuri" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py deleted file mode 100644 index 26eff9ce07a..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriLowLevel/custombaseurllowlevel/rest/paths/_request_builders_py3.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get a 200 to test a valid base uri. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customuri" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/__init__.py index 5daa0aa077d..b03437179b1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_empty_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_empty_request # type: ignore +from ._request_builders import build_get_empty_request __all__ = [ "build_get_empty_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders.py index fcbd3594c46..0aa08a01d41 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders.py @@ -16,14 +16,10 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_empty_request( - key_name, # type: str - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + key_name: str, subscription_id: str, *, key_version: str = "v1", **kwargs: Any +) -> HttpRequest: """Get a 200 to test a valid base uri. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -44,29 +40,22 @@ def build_get_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - key_version = kwargs.pop('key_version', _params.pop('keyVersion', "v1")) # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/customuri/{subscriptionId}/{keyName}" path_format_arguments = { - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "keyName": _SERIALIZER.url("key_name", key_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if key_version is not None: - _params['keyVersion'] = _SERIALIZER.query("key_version", key_version, 'str') + _params["keyVersion"] = _SERIALIZER.query("key_version", key_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders_py3.py deleted file mode 100644 index 63d9224e178..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/CustomBaseUriMoreOptionsLowLevel/custombaseurlmoreoptionslowlevel/rest/paths/_request_builders_py3.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_empty_request( - key_name: str, - subscription_id: str, - *, - key_version: str = "v1", - **kwargs: Any -) -> HttpRequest: - """Get a 200 to test a valid base uri. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param key_name: The key name with value 'key1'. Required. - :type key_name: str - :param subscription_id: The subscription id with value 'test12'. Required. - :type subscription_id: str - :keyword key_version: The key version. Default value 'v1'. Default value is "v1". - :paramtype key_version: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/customuri/{subscriptionId}/{keyName}" - path_format_arguments = { - "keyName": _SERIALIZER.url("key_name", key_name, 'str'), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - if key_version is not None: - _params['keyVersion'] = _SERIALIZER.query("key_version", key_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/_client.py index d409d7aa1dd..60282948efa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/_client.py @@ -28,7 +28,6 @@ class ErrorWithSecrets: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = ErrorWithSecretsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/__init__.py index 741180de779..6796b25d19d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_create_secret_request - from ._request_builders_py3 import build_get_error_with_secrets_request -except (SyntaxError, ImportError): - from ._request_builders import build_create_secret_request # type: ignore - from ._request_builders import build_get_error_with_secrets_request # type: ignore +from ._request_builders import build_create_secret_request +from ._request_builders import build_get_error_with_secrets_request __all__ = [ "build_create_secret_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/_request_builders.py index a5a766fcbaf..dcd6df0242d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_create_secret_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_create_secret_request(**kwargs: Any) -> HttpRequest: """Creates a secret. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_create_secret_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/secrets/:create" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_get_error_with_secrets_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_error_with_secrets_request(**kwargs: Any) -> HttpRequest: """Gets an error response containing secrets and PII. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,17 +55,12 @@ def build_get_error_with_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/secrets/error" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 26e9c54449c..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ErrorWithSecretsLowLevel/errorwithsecretslowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,81 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_create_secret_request( - **kwargs: Any -) -> HttpRequest: - """Creates a secret. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/secrets/:create" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_error_with_secrets_request( - **kwargs: Any -) -> HttpRequest: - """Gets an error response containing secrets and PII. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/secrets/error" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_client.py index 03641cd8ec2..ae53c7f3482 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/_client.py @@ -28,7 +28,6 @@ class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = PetStoreIncConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/__init__.py index c2d46d43efe..934eaebadd4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_by_pet_id_request - from ._request_builders_py3 import build_add_pet_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_by_pet_id_request # type: ignore - from ._request_builders import build_add_pet_request # type: ignore +from ._request_builders import build_get_by_pet_id_request +from ._request_builders import build_add_pet_request __all__ = [ "build_get_by_pet_id_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py index 97c588ae3ec..e67539a46fd 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders.py @@ -23,13 +23,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_by_pet_id_request( - pet_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_by_pet_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: """get pet by id. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -45,32 +40,26 @@ def build_get_by_pet_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/extensibleenums/pet/{petId}" path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, 'str'), + "petId": _SERIALIZER.url("pet_id", pet_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_add_pet_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """add pet. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -102,9 +91,8 @@ def build_add_pet_request( @overload def build_add_pet_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """add pet. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -122,10 +110,7 @@ def build_add_pet_request( """ -def build_add_pet_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_add_pet_request(**kwargs: Any) -> HttpRequest: """add pet. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -144,20 +129,15 @@ def build_add_pet_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/extensibleenums/pet/addPet" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py deleted file mode 100644 index 4c9394d04e4..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ExtensibleEnumsLowLevel/extensibleenumsswaggerlowlevel/rest/pet/_request_builders_py3.py +++ /dev/null @@ -1,165 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_by_pet_id_request( - pet_id: str, - **kwargs: Any -) -> HttpRequest: - """get pet by id. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param pet_id: Pet id. Required. - :type pet_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/extensibleenums/pet/{petId}" - path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_add_pet_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """add pet. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: pet param. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "DaysOfWeek": "Friday", # Optional. Default value is "Friday". Type of Pet. - Known values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", - "Saturday", and "Sunday". - "IntEnum": "str", # Required. Known values are: "1", "2", and "3". - "name": "str" # Optional. name. - } - """ - - -@overload -def build_add_pet_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """add pet. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: pet param. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_add_pet_request( - **kwargs: Any -) -> HttpRequest: - """add pet. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: pet param. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/extensibleenums/pet/addPet" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_client.py index abac6edc2b7..fca5c48a604 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-ver """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATHeaderServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py index 62ca0400102..9bde850d82b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/__init__.py @@ -6,66 +6,35 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_param_existing_key_request - from ._request_builders_py3 import build_response_existing_key_request - from ._request_builders_py3 import build_param_protected_key_request - from ._request_builders_py3 import build_response_protected_key_request - from ._request_builders_py3 import build_param_integer_request - from ._request_builders_py3 import build_response_integer_request - from ._request_builders_py3 import build_param_long_request - from ._request_builders_py3 import build_response_long_request - from ._request_builders_py3 import build_param_float_request - from ._request_builders_py3 import build_response_float_request - from ._request_builders_py3 import build_param_double_request - from ._request_builders_py3 import build_response_double_request - from ._request_builders_py3 import build_param_bool_request - from ._request_builders_py3 import build_response_bool_request - from ._request_builders_py3 import build_param_string_request - from ._request_builders_py3 import build_response_string_request - from ._request_builders_py3 import build_param_date_request - from ._request_builders_py3 import build_response_date_request - from ._request_builders_py3 import build_param_datetime_request - from ._request_builders_py3 import build_response_datetime_request - from ._request_builders_py3 import build_param_datetime_rfc1123_request - from ._request_builders_py3 import build_response_datetime_rfc1123_request - from ._request_builders_py3 import build_param_duration_request - from ._request_builders_py3 import build_response_duration_request - from ._request_builders_py3 import build_param_byte_request - from ._request_builders_py3 import build_response_byte_request - from ._request_builders_py3 import build_param_enum_request - from ._request_builders_py3 import build_response_enum_request - from ._request_builders_py3 import build_custom_request_id_request -except (SyntaxError, ImportError): - from ._request_builders import build_param_existing_key_request # type: ignore - from ._request_builders import build_response_existing_key_request # type: ignore - from ._request_builders import build_param_protected_key_request # type: ignore - from ._request_builders import build_response_protected_key_request # type: ignore - from ._request_builders import build_param_integer_request # type: ignore - from ._request_builders import build_response_integer_request # type: ignore - from ._request_builders import build_param_long_request # type: ignore - from ._request_builders import build_response_long_request # type: ignore - from ._request_builders import build_param_float_request # type: ignore - from ._request_builders import build_response_float_request # type: ignore - from ._request_builders import build_param_double_request # type: ignore - from ._request_builders import build_response_double_request # type: ignore - from ._request_builders import build_param_bool_request # type: ignore - from ._request_builders import build_response_bool_request # type: ignore - from ._request_builders import build_param_string_request # type: ignore - from ._request_builders import build_response_string_request # type: ignore - from ._request_builders import build_param_date_request # type: ignore - from ._request_builders import build_response_date_request # type: ignore - from ._request_builders import build_param_datetime_request # type: ignore - from ._request_builders import build_response_datetime_request # type: ignore - from ._request_builders import build_param_datetime_rfc1123_request # type: ignore - from ._request_builders import build_response_datetime_rfc1123_request # type: ignore - from ._request_builders import build_param_duration_request # type: ignore - from ._request_builders import build_response_duration_request # type: ignore - from ._request_builders import build_param_byte_request # type: ignore - from ._request_builders import build_response_byte_request # type: ignore - from ._request_builders import build_param_enum_request # type: ignore - from ._request_builders import build_response_enum_request # type: ignore - from ._request_builders import build_custom_request_id_request # type: ignore +from ._request_builders import build_param_existing_key_request +from ._request_builders import build_response_existing_key_request +from ._request_builders import build_param_protected_key_request +from ._request_builders import build_response_protected_key_request +from ._request_builders import build_param_integer_request +from ._request_builders import build_response_integer_request +from ._request_builders import build_param_long_request +from ._request_builders import build_response_long_request +from ._request_builders import build_param_float_request +from ._request_builders import build_response_float_request +from ._request_builders import build_param_double_request +from ._request_builders import build_response_double_request +from ._request_builders import build_param_bool_request +from ._request_builders import build_response_bool_request +from ._request_builders import build_param_string_request +from ._request_builders import build_response_string_request +from ._request_builders import build_param_date_request +from ._request_builders import build_response_date_request +from ._request_builders import build_param_datetime_request +from ._request_builders import build_response_datetime_request +from ._request_builders import build_param_datetime_rfc1123_request +from ._request_builders import build_response_datetime_rfc1123_request +from ._request_builders import build_param_duration_request +from ._request_builders import build_response_duration_request +from ._request_builders import build_param_byte_request +from ._request_builders import build_response_byte_request +from ._request_builders import build_param_enum_request +from ._request_builders import build_response_enum_request +from ._request_builders import build_custom_request_id_request __all__ = [ "build_param_existing_key_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders.py index d492312a199..4ec9fdee26c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_param_existing_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_existing_key_request(*, user_agent_parameter: str, **kwargs: Any) -> HttpRequest: """Send a post request with header value "User-Agent": "overwrite". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -38,28 +34,19 @@ def build_param_existing_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - user_agent_parameter = kwargs.pop('user_agent_parameter') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/existingkey" # Construct headers - _headers['User-Agent'] = _SERIALIZER.header("user_agent_parameter", user_agent_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["User-Agent"] = _SERIALIZER.header("user_agent_parameter", user_agent_parameter, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_response_existing_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_response_existing_key_request(**kwargs: Any) -> HttpRequest: """Get a response with header value "User-Agent": "overwrite". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -73,26 +60,18 @@ def build_response_existing_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/existingkey" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_protected_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_protected_key_request(**kwargs: Any) -> HttpRequest: """Send a post request with header value "Content-Type": "text/html". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -109,28 +88,20 @@ def build_param_protected_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type') # type: str - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type") # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/protectedkey" # Construct headers - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_response_protected_key_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_response_protected_key_request(**kwargs: Any) -> HttpRequest: """Get a response with header value "Content-Type": "text/html". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -144,26 +115,18 @@ def build_response_protected_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/protectedkey" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_integer_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_integer_request(*, scenario: str, value: int, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "positive", "value": 1 or "scenario": "negative", "value": -2. @@ -183,30 +146,20 @@ def build_param_integer_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/integer" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_integer_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "int") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_integer_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header value "value": 1 or -2. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -223,28 +176,19 @@ def build_response_integer_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/integer" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_long_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_long_request(*, scenario: str, value: int, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "positive", "value": 105 or "scenario": "negative", "value": -2. @@ -264,30 +208,20 @@ def build_param_long_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/long" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_long_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "int") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_long_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header value "value": 105 or -2. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -304,28 +238,19 @@ def build_response_long_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/long" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_float_request(*, scenario: str, value: float, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "positive", "value": 0.07 or "scenario": "negative", "value": -3.0. @@ -345,30 +270,20 @@ def build_param_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: float - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/float" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'float') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_float_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "float") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_float_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header value "value": 0.07 or -3.0. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -385,28 +300,19 @@ def build_response_float_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/float" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_double_request(*, scenario: str, value: float, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "positive", "value": 7e120 or "scenario": "negative", "value": -3.0. @@ -426,30 +332,20 @@ def build_param_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: float - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/double" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'float') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_double_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "float") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_double_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header value "value": 7e120 or -3.0. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -466,28 +362,19 @@ def build_response_double_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/double" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_bool_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_bool_request(*, scenario: str, value: bool, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "true", "value": true or "scenario": "false", "value": false. @@ -507,30 +394,20 @@ def build_param_bool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: bool - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/bool" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'bool') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_bool_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "bool") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_bool_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header value "value": true or false. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -547,28 +424,19 @@ def build_response_bool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/bool" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_string_request(*, scenario: str, value: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "The quick brown fox jumps over the lazy dog" or "scenario": "null", "value": null or "scenario": "empty", "value": "". @@ -589,31 +457,21 @@ def build_param_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value', _headers.pop('value', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/string" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") if value is not None: - _headers['value'] = _SERIALIZER.header("value", value, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["value"] = _SERIALIZER.header("value", value, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_response_string_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_response_string_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header values "The quick brown fox jumps over the lazy dog" or null or "". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -630,28 +488,19 @@ def build_response_string_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/string" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_date_request(*, scenario: str, value: datetime.date, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "2010-01-01" or "scenario": "min", "value": "0001-01-01". @@ -671,30 +520,20 @@ def build_param_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: datetime.date - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/date" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'date') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_date_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "date") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_date_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header values "2010-01-01" or "0001-01-01". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -711,28 +550,19 @@ def build_response_date_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/date" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_datetime_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_datetime_request(*, scenario: str, value: datetime.datetime, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "2010-01-01T12:34:56Z" or "scenario": "min", "value": "0001-01-01T00:00:00Z". @@ -753,30 +583,20 @@ def build_param_datetime_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: datetime.datetime - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/datetime" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'iso-8601') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_datetime_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "iso-8601") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_datetime_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -793,28 +613,21 @@ def build_response_datetime_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/datetime" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) def build_param_datetime_rfc1123_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, scenario: str, value: Optional[datetime.datetime] = None, **kwargs: Any +) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "Wed, 01 Jan 2010 12:34:56 GMT" or "scenario": "min", "value": "Mon, 01 Jan 0001 00:00:00 GMT". @@ -835,31 +648,21 @@ def build_param_datetime_rfc1123_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value', _headers.pop('value', None)) # type: Optional[datetime.datetime] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/datetimerfc1123" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") if value is not None: - _headers['value'] = _SERIALIZER.header("value", value, 'rfc-1123') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["value"] = _SERIALIZER.header("value", value, "rfc-1123") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_response_datetime_rfc1123_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_response_datetime_rfc1123_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT". @@ -877,28 +680,19 @@ def build_response_datetime_rfc1123_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/datetimerfc1123" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_duration_request(*, scenario: str, value: datetime.timedelta, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "P123DT22H14M12.011S". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -916,30 +710,20 @@ def build_param_duration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: datetime.timedelta - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/duration" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'duration') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_duration_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "duration") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_duration_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header values "P123DT22H14M12.011S". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -955,28 +739,19 @@ def build_response_duration_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/duration" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_byte_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_byte_request(*, scenario: str, value: bytes, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "啊齄丂狛狜隣郎隣兀﨩". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -994,30 +769,20 @@ def build_param_byte_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value') # type: bytes - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/byte" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'bytearray') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_byte_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["value"] = _SERIALIZER.header("value", value, "bytearray") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_response_byte_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header values "啊齄丂狛狜隣郎隣兀﨩". See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1033,28 +798,19 @@ def build_response_byte_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/byte" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_param_enum_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_param_enum_request(*, scenario: str, value: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Send a post request with header values "scenario": "valid", "value": "GREY" or "scenario": "null", "value": null. @@ -1075,31 +831,21 @@ def build_param_enum_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - value = kwargs.pop('value', _headers.pop('value', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/param/prim/enum" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") if value is not None: - _headers['value'] = _SERIALIZER.header("value", value, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["value"] = _SERIALIZER.header("value", value, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_response_enum_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_response_enum_request(*, scenario: str, **kwargs: Any) -> HttpRequest: """Get a response with header values "GREY" or null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1116,28 +862,19 @@ def build_response_enum_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - scenario = kwargs.pop('scenario') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/response/prim/enum" # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["scenario"] = _SERIALIZER.header("scenario", scenario, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_custom_request_id_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_custom_request_id_request(**kwargs: Any) -> HttpRequest: """Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request. @@ -1152,17 +889,12 @@ def build_custom_request_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders_py3.py deleted file mode 100644 index 957aa92cbcf..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HeaderLowLevel/headerlowlevel/rest/header/_request_builders_py3.py +++ /dev/null @@ -1,1164 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_param_existing_key_request( - *, - user_agent_parameter: str, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header value "User-Agent": "overwrite". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword user_agent_parameter: Send a post request with header value "User-Agent": "overwrite". - Required. - :paramtype user_agent_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/existingkey" - - # Construct headers - _headers['User-Agent'] = _SERIALIZER.header("user_agent_parameter", user_agent_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_existing_key_request( - **kwargs: Any -) -> HttpRequest: - """Get a response with header value "User-Agent": "overwrite". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/existingkey" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_protected_key_request( - **kwargs: Any -) -> HttpRequest: - """Send a post request with header value "Content-Type": "text/html". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Send a post request with header value "Content-Type": "text/html". - Required. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type') # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/protectedkey" - - # Construct headers - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_protected_key_request( - **kwargs: Any -) -> HttpRequest: - """Get a response with header value "Content-Type": "text/html". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/protectedkey" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_integer_request( - *, - scenario: str, - value: int, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "positive", "value": 1 or "scenario": - "negative", "value": -2. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". - Required. - :paramtype scenario: str - :keyword value: Send a post request with header values 1 or -2. Required. - :paramtype value: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/integer" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_integer_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header value "value": 1 or -2. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". - Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/integer" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_long_request( - *, - scenario: str, - value: int, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "positive", "value": 105 or "scenario": - "negative", "value": -2. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". - Required. - :paramtype scenario: str - :keyword value: Send a post request with header values 105 or -2. Required. - :paramtype value: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/long" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_long_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header value "value": 105 or -2. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". - Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/long" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_float_request( - *, - scenario: str, - value: float, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "positive", "value": 0.07 or "scenario": - "negative", "value": -3.0. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". - Required. - :paramtype scenario: str - :keyword value: Send a post request with header values 0.07 or -3.0. Required. - :paramtype value: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/float" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'float') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_float_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header value "value": 0.07 or -3.0. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". - Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/float" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_double_request( - *, - scenario: str, - value: float, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "positive", "value": 7e120 or "scenario": - "negative", "value": -3.0. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". - Required. - :paramtype scenario: str - :keyword value: Send a post request with header values 7e120 or -3.0. Required. - :paramtype value: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/double" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'float') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_double_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header value "value": 7e120 or -3.0. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "positive" or "negative". - Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/double" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_bool_request( - *, - scenario: str, - value: bool, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "true", "value": true or "scenario": - "false", "value": false. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "true" or "false". - Required. - :paramtype scenario: str - :keyword value: Send a post request with header values true or false. Required. - :paramtype value: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/bool" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'bool') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_bool_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header value "value": true or false. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "true" or "false". - Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/bool" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_string_request( - *, - scenario: str, - value: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "valid", "value": "The quick brown fox jumps - over the lazy dog" or "scenario": "null", "value": null or "scenario": "empty", "value": "". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "null" or - "empty". Required. - :paramtype scenario: str - :keyword value: Send a post request with header values "The quick brown fox jumps over the lazy - dog" or null or "". Default value is None. - :paramtype value: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/string" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - if value is not None: - _headers['value'] = _SERIALIZER.header("value", value, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_string_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header values "The quick brown fox jumps over the lazy dog" or null or "". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "null" or - "empty". Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/string" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_date_request( - *, - scenario: str, - value: datetime.date, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "valid", "value": "2010-01-01" or - "scenario": "min", "value": "0001-01-01". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "min". - Required. - :paramtype scenario: str - :keyword value: Send a post request with header values "2010-01-01" or "0001-01-01". Required. - :paramtype value: ~datetime.date - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/date" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'date') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_date_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header values "2010-01-01" or "0001-01-01". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "min". - Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/date" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_datetime_request( - *, - scenario: str, - value: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "valid", "value": "2010-01-01T12:34:56Z" or - "scenario": "min", "value": "0001-01-01T00:00:00Z". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "min". - Required. - :paramtype scenario: str - :keyword value: Send a post request with header values "2010-01-01T12:34:56Z" or - "0001-01-01T00:00:00Z". Required. - :paramtype value: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/datetime" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'iso-8601') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_datetime_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header values "2010-01-01T12:34:56Z" or "0001-01-01T00:00:00Z". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "min". - Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/datetime" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_datetime_rfc1123_request( - *, - scenario: str, - value: Optional[datetime.datetime] = None, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "valid", "value": "Wed, 01 Jan 2010 12:34:56 - GMT" or "scenario": "min", "value": "Mon, 01 Jan 0001 00:00:00 GMT". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "min". - Required. - :paramtype scenario: str - :keyword value: Send a post request with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, - 01 Jan 0001 00:00:00 GMT". Default value is None. - :paramtype value: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/datetimerfc1123" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - if value is not None: - _headers['value'] = _SERIALIZER.header("value", value, 'rfc-1123') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_datetime_rfc1123_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 - GMT". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "min". - Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/datetimerfc1123" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_duration_request( - *, - scenario: str, - value: datetime.timedelta, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "valid", "value": "P123DT22H14M12.011S". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid". Required. - :paramtype scenario: str - :keyword value: Send a post request with header values "P123DT22H14M12.011S". Required. - :paramtype value: ~datetime.timedelta - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/duration" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'duration') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_duration_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header values "P123DT22H14M12.011S". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid". Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/duration" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_byte_request( - *, - scenario: str, - value: bytes, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "valid", "value": "啊齄丂狛狜隣郎隣兀﨩". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid". Required. - :paramtype scenario: str - :keyword value: Send a post request with header values "啊齄丂狛狜隣郎隣兀﨩". Required. - :paramtype value: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/byte" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['value'] = _SERIALIZER.header("value", value, 'bytearray') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_byte_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header values "啊齄丂狛狜隣郎隣兀﨩". - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid". Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/byte" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_param_enum_request( - *, - scenario: str, - value: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Send a post request with header values "scenario": "valid", "value": "GREY" or "scenario": - "null", "value": null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "null" or - "empty". Required. - :paramtype scenario: str - :keyword value: Send a post request with header values 'GREY'. Known values are: "White", - "black", and "GREY". Default value is None. - :paramtype value: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/param/prim/enum" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - if value is not None: - _headers['value'] = _SERIALIZER.header("value", value, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_response_enum_request( - *, - scenario: str, - **kwargs: Any -) -> HttpRequest: - """Get a response with header values "GREY" or null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword scenario: Send a post request with header values "scenario": "valid" or "null" or - "empty". Required. - :paramtype scenario: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/response/prim/enum" - - # Construct headers - _headers['scenario'] = _SERIALIZER.header("scenario", scenario, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_custom_request_id_request( - **kwargs: Any -) -> HttpRequest: - """Send x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the - request. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/header/custom/x-ms-client-request-id/9C4D50EE-2D56-4CD3-8152-34347DC9F2B0" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_client.py index 9e32539ce4f..6646c3cd77f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-a """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestHttpInfrastructureTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/__init__.py index 014c45ac99e..b33de025709 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/__init__.py @@ -6,60 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head400_request - from ._request_builders_py3 import build_get400_request - from ._request_builders_py3 import build_options400_request - from ._request_builders_py3 import build_put400_request - from ._request_builders_py3 import build_patch400_request - from ._request_builders_py3 import build_post400_request - from ._request_builders_py3 import build_delete400_request - from ._request_builders_py3 import build_head401_request - from ._request_builders_py3 import build_get402_request - from ._request_builders_py3 import build_options403_request - from ._request_builders_py3 import build_get403_request - from ._request_builders_py3 import build_put404_request - from ._request_builders_py3 import build_patch405_request - from ._request_builders_py3 import build_post406_request - from ._request_builders_py3 import build_delete407_request - from ._request_builders_py3 import build_put409_request - from ._request_builders_py3 import build_head410_request - from ._request_builders_py3 import build_get411_request - from ._request_builders_py3 import build_options412_request - from ._request_builders_py3 import build_get412_request - from ._request_builders_py3 import build_put413_request - from ._request_builders_py3 import build_patch414_request - from ._request_builders_py3 import build_post415_request - from ._request_builders_py3 import build_get416_request - from ._request_builders_py3 import build_delete417_request - from ._request_builders_py3 import build_head429_request -except (SyntaxError, ImportError): - from ._request_builders import build_head400_request # type: ignore - from ._request_builders import build_get400_request # type: ignore - from ._request_builders import build_options400_request # type: ignore - from ._request_builders import build_put400_request # type: ignore - from ._request_builders import build_patch400_request # type: ignore - from ._request_builders import build_post400_request # type: ignore - from ._request_builders import build_delete400_request # type: ignore - from ._request_builders import build_head401_request # type: ignore - from ._request_builders import build_get402_request # type: ignore - from ._request_builders import build_options403_request # type: ignore - from ._request_builders import build_get403_request # type: ignore - from ._request_builders import build_put404_request # type: ignore - from ._request_builders import build_patch405_request # type: ignore - from ._request_builders import build_post406_request # type: ignore - from ._request_builders import build_delete407_request # type: ignore - from ._request_builders import build_put409_request # type: ignore - from ._request_builders import build_head410_request # type: ignore - from ._request_builders import build_get411_request # type: ignore - from ._request_builders import build_options412_request # type: ignore - from ._request_builders import build_get412_request # type: ignore - from ._request_builders import build_put413_request # type: ignore - from ._request_builders import build_patch414_request # type: ignore - from ._request_builders import build_post415_request # type: ignore - from ._request_builders import build_get416_request # type: ignore - from ._request_builders import build_delete417_request # type: ignore - from ._request_builders import build_head429_request # type: ignore +from ._request_builders import build_head400_request +from ._request_builders import build_get400_request +from ._request_builders import build_options400_request +from ._request_builders import build_put400_request +from ._request_builders import build_patch400_request +from ._request_builders import build_post400_request +from ._request_builders import build_delete400_request +from ._request_builders import build_head401_request +from ._request_builders import build_get402_request +from ._request_builders import build_options403_request +from ._request_builders import build_get403_request +from ._request_builders import build_put404_request +from ._request_builders import build_patch405_request +from ._request_builders import build_post406_request +from ._request_builders import build_delete407_request +from ._request_builders import build_put409_request +from ._request_builders import build_head410_request +from ._request_builders import build_get411_request +from ._request_builders import build_options412_request +from ._request_builders import build_get412_request +from ._request_builders import build_put413_request +from ._request_builders import build_patch414_request +from ._request_builders import build_post415_request +from ._request_builders import build_get416_request +from ._request_builders import build_delete417_request +from ._request_builders import build_head429_request __all__ = [ "build_head400_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py index 7035cf0eb08..75bbe41b139 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head400_request(**kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_head400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/400" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get400_request(**kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/400" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_options400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_options400_request(**kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,26 +80,18 @@ def build_options400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/400" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="OPTIONS", url=_url, headers=_headers, **kwargs) -def build_put400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put400_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -136,29 +108,21 @@ def build_put400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch400_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -175,29 +139,21 @@ def build_patch400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_post400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post400_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -214,29 +170,21 @@ def build_post400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_delete400_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete400_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 400 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -253,29 +201,21 @@ def build_delete400_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/400" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) -def build_head401_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head401_request(**kwargs: Any) -> HttpRequest: """Return 401 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -289,26 +229,18 @@ def build_head401_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/401" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get402_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get402_request(**kwargs: Any) -> HttpRequest: """Return 402 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -322,26 +254,18 @@ def build_get402_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/402" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_options403_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_options403_request(**kwargs: Any) -> HttpRequest: """Return 403 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -355,26 +279,18 @@ def build_options403_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/403" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="OPTIONS", url=_url, headers=_headers, **kwargs) -def build_get403_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get403_request(**kwargs: Any) -> HttpRequest: """Return 403 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -388,26 +304,18 @@ def build_get403_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/403" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put404_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 404 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -424,29 +332,21 @@ def build_put404_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/404" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch405_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch405_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 405 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -463,29 +363,21 @@ def build_patch405_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/405" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_post406_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post406_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 406 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -502,29 +394,21 @@ def build_post406_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/406" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_delete407_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete407_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 407 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -541,29 +425,21 @@ def build_delete407_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/407" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) -def build_put409_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put409_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 409 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -580,29 +456,21 @@ def build_put409_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/409" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_head410_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head410_request(**kwargs: Any) -> HttpRequest: """Return 410 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -616,26 +484,18 @@ def build_head410_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/410" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get411_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get411_request(**kwargs: Any) -> HttpRequest: """Return 411 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -649,26 +509,18 @@ def build_get411_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/411" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_options412_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_options412_request(**kwargs: Any) -> HttpRequest: """Return 412 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -682,26 +534,18 @@ def build_options412_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/412" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="OPTIONS", url=_url, headers=_headers, **kwargs) -def build_get412_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get412_request(**kwargs: Any) -> HttpRequest: """Return 412 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -715,26 +559,18 @@ def build_get412_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/412" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put413_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put413_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 413 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -751,29 +587,21 @@ def build_put413_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/413" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch414_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch414_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 414 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -790,29 +618,21 @@ def build_patch414_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/414" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_post415_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post415_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 415 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -829,29 +649,21 @@ def build_post415_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/415" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_get416_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get416_request(**kwargs: Any) -> HttpRequest: """Return 416 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -865,26 +677,18 @@ def build_get416_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/416" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_delete417_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete417_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 417 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -901,29 +705,21 @@ def build_delete417_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/417" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) -def build_head429_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head429_request(**kwargs: Any) -> HttpRequest: """Return 429 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -937,17 +733,12 @@ def build_head429_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/client/429" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py deleted file mode 100644 index 65e76a89c37..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_client_failure/_request_builders_py3.py +++ /dev/null @@ -1,966 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head400_request( - **kwargs: Any -) -> HttpRequest: - """Return 400 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/400" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get400_request( - **kwargs: Any -) -> HttpRequest: - """Return 400 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/400" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_options400_request( - **kwargs: Any -) -> HttpRequest: - """Return 400 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/400" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put400_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 400 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch400_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 400 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post400_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 400 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_delete400_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 400 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/400" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_head401_request( - **kwargs: Any -) -> HttpRequest: - """Return 401 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/401" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get402_request( - **kwargs: Any -) -> HttpRequest: - """Return 402 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/402" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_options403_request( - **kwargs: Any -) -> HttpRequest: - """Return 403 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/403" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get403_request( - **kwargs: Any -) -> HttpRequest: - """Return 403 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/403" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put404_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 404 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/404" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch405_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 405 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/405" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post406_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 406 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/406" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_delete407_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 407 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/407" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_put409_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 409 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/409" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_head410_request( - **kwargs: Any -) -> HttpRequest: - """Return 410 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/410" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get411_request( - **kwargs: Any -) -> HttpRequest: - """Return 411 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/411" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_options412_request( - **kwargs: Any -) -> HttpRequest: - """Return 412 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/412" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get412_request( - **kwargs: Any -) -> HttpRequest: - """Return 412 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/412" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put413_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 413 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/413" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch414_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 414 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/414" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post415_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 415 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/415" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get416_request( - **kwargs: Any -) -> HttpRequest: - """Return 416 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/416" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_delete417_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 417 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/417" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_head429_request( - **kwargs: Any -) -> HttpRequest: - """Return 429 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/client/429" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/__init__.py index 9aa026c9102..6931dbc7cd9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_empty_error_request - from ._request_builders_py3 import build_get_no_model_error_request - from ._request_builders_py3 import build_get_no_model_empty_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_empty_error_request # type: ignore - from ._request_builders import build_get_no_model_error_request # type: ignore - from ._request_builders import build_get_no_model_empty_request # type: ignore +from ._request_builders import build_get_empty_error_request +from ._request_builders import build_get_no_model_error_request +from ._request_builders import build_get_no_model_empty_request __all__ = [ "build_get_empty_error_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py index fb6ad2ccd8e..ea09c04e2a6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_empty_error_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_error_request(**kwargs: Any) -> HttpRequest: """Get empty error form server. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_get_empty_error_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/emptybody/error" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_no_model_error_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_no_model_error_request(**kwargs: Any) -> HttpRequest: """Get empty error form server. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get_no_model_error_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/nomodel/error" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_no_model_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_no_model_empty_request(**kwargs: Any) -> HttpRequest: """Get empty response from server. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,17 +80,12 @@ def build_get_no_model_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/nomodel/empty" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py deleted file mode 100644 index dc890434557..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_failure/_request_builders_py3.py +++ /dev/null @@ -1,113 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_empty_error_request( - **kwargs: Any -) -> HttpRequest: - """Get empty error form server. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/emptybody/error" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_no_model_error_request( - **kwargs: Any -) -> HttpRequest: - """Get empty error form server. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/nomodel/error" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_no_model_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get empty response from server. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/nomodel/empty" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/__init__.py index 32da62631a7..bd5acc91340 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/__init__.py @@ -6,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head300_request - from ._request_builders_py3 import build_get300_request - from ._request_builders_py3 import build_head301_request - from ._request_builders_py3 import build_get301_request - from ._request_builders_py3 import build_put301_request - from ._request_builders_py3 import build_head302_request - from ._request_builders_py3 import build_get302_request - from ._request_builders_py3 import build_patch302_request - from ._request_builders_py3 import build_post303_request - from ._request_builders_py3 import build_head307_request - from ._request_builders_py3 import build_get307_request - from ._request_builders_py3 import build_options307_request - from ._request_builders_py3 import build_put307_request - from ._request_builders_py3 import build_patch307_request - from ._request_builders_py3 import build_post307_request - from ._request_builders_py3 import build_delete307_request -except (SyntaxError, ImportError): - from ._request_builders import build_head300_request # type: ignore - from ._request_builders import build_get300_request # type: ignore - from ._request_builders import build_head301_request # type: ignore - from ._request_builders import build_get301_request # type: ignore - from ._request_builders import build_put301_request # type: ignore - from ._request_builders import build_head302_request # type: ignore - from ._request_builders import build_get302_request # type: ignore - from ._request_builders import build_patch302_request # type: ignore - from ._request_builders import build_post303_request # type: ignore - from ._request_builders import build_head307_request # type: ignore - from ._request_builders import build_get307_request # type: ignore - from ._request_builders import build_options307_request # type: ignore - from ._request_builders import build_put307_request # type: ignore - from ._request_builders import build_patch307_request # type: ignore - from ._request_builders import build_post307_request # type: ignore - from ._request_builders import build_delete307_request # type: ignore +from ._request_builders import build_head300_request +from ._request_builders import build_get300_request +from ._request_builders import build_head301_request +from ._request_builders import build_get301_request +from ._request_builders import build_put301_request +from ._request_builders import build_head302_request +from ._request_builders import build_get302_request +from ._request_builders import build_patch302_request +from ._request_builders import build_post303_request +from ._request_builders import build_head307_request +from ._request_builders import build_get307_request +from ._request_builders import build_options307_request +from ._request_builders import build_put307_request +from ._request_builders import build_patch307_request +from ._request_builders import build_post307_request +from ._request_builders import build_delete307_request __all__ = [ "build_head300_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py index 907646c635b..92a6876f20b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head300_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head300_request(**kwargs: Any) -> HttpRequest: """Return 300 status code and redirect to /http/success/200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_head300_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/300" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get300_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get300_request(**kwargs: Any) -> HttpRequest: """Return 300 status code and redirect to /http/success/200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get300_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/300" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_head301_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head301_request(**kwargs: Any) -> HttpRequest: """Return 301 status code and redirect to /http/success/200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,26 +80,18 @@ def build_head301_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/301" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get301_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get301_request(**kwargs: Any) -> HttpRequest: """Return 301 status code and redirect to /http/success/200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -133,26 +105,18 @@ def build_get301_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/301" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put301_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put301_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Put true Boolean value in request returns 301. This request should not be automatically redirected, but should return the received 301 to the caller for evaluation. @@ -170,29 +134,21 @@ def build_put301_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/301" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_head302_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head302_request(**kwargs: Any) -> HttpRequest: """Return 302 status code and redirect to /http/success/200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -206,26 +162,18 @@ def build_head302_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/302" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get302_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get302_request(**kwargs: Any) -> HttpRequest: """Return 302 status code and redirect to /http/success/200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -239,26 +187,18 @@ def build_get302_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/302" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_patch302_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch302_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Patch true Boolean value in request returns 302. This request should not be automatically redirected, but should return the received 302 to the caller for evaluation. @@ -276,29 +216,21 @@ def build_patch302_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/302" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_post303_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post303_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Post true Boolean value in request returns 303. This request should be automatically redirected usign a get, ultimately returning a 200 status code. @@ -316,29 +248,21 @@ def build_post303_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/303" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_head307_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head307_request(**kwargs: Any) -> HttpRequest: """Redirect with 307, resulting in a 200 success. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -352,26 +276,18 @@ def build_head307_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/307" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get307_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get307_request(**kwargs: Any) -> HttpRequest: """Redirect get with 307, resulting in a 200 success. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -385,26 +301,18 @@ def build_get307_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/307" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_options307_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_options307_request(**kwargs: Any) -> HttpRequest: """options redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -418,26 +326,18 @@ def build_options307_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/307" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="OPTIONS", url=_url, headers=_headers, **kwargs) -def build_put307_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put307_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Put redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -454,29 +354,21 @@ def build_put307_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/307" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch307_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch307_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Patch redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -493,29 +385,21 @@ def build_patch307_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/307" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_post307_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post307_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Post redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -532,29 +416,21 @@ def build_post307_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/307" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_delete307_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete307_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Delete redirected with 307, resulting in a 200 after redirect. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -571,20 +447,15 @@ def build_delete307_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/redirect/307" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py deleted file mode 100644 index 0305c002e09..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_redirects/_request_builders_py3.py +++ /dev/null @@ -1,595 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head300_request( - **kwargs: Any -) -> HttpRequest: - """Return 300 status code and redirect to /http/success/200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/300" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get300_request( - **kwargs: Any -) -> HttpRequest: - """Return 300 status code and redirect to /http/success/200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/300" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_head301_request( - **kwargs: Any -) -> HttpRequest: - """Return 301 status code and redirect to /http/success/200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/301" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get301_request( - **kwargs: Any -) -> HttpRequest: - """Return 301 status code and redirect to /http/success/200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/301" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put301_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Put true Boolean value in request returns 301. This request should not be automatically - redirected, but should return the received 301 to the caller for evaluation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/301" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_head302_request( - **kwargs: Any -) -> HttpRequest: - """Return 302 status code and redirect to /http/success/200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/302" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get302_request( - **kwargs: Any -) -> HttpRequest: - """Return 302 status code and redirect to /http/success/200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/302" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_patch302_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Patch true Boolean value in request returns 302. This request should not be automatically - redirected, but should return the received 302 to the caller for evaluation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/302" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post303_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Post true Boolean value in request returns 303. This request should be automatically - redirected usign a get, ultimately returning a 200 status code. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/303" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_head307_request( - **kwargs: Any -) -> HttpRequest: - """Redirect with 307, resulting in a 200 success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/307" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get307_request( - **kwargs: Any -) -> HttpRequest: - """Redirect get with 307, resulting in a 200 success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/307" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_options307_request( - **kwargs: Any -) -> HttpRequest: - """options redirected with 307, resulting in a 200 after redirect. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/307" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put307_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Put redirected with 307, resulting in a 200 after redirect. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/307" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch307_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Patch redirected with 307, resulting in a 200 after redirect. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/307" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post307_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Post redirected with 307, resulting in a 200 after redirect. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/307" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_delete307_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Delete redirected with 307, resulting in a 200 after redirect. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/redirect/307" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/__init__.py index c645a81dabd..9ead470ba37 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/__init__.py @@ -6,26 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head408_request - from ._request_builders_py3 import build_put500_request - from ._request_builders_py3 import build_patch500_request - from ._request_builders_py3 import build_get502_request - from ._request_builders_py3 import build_options502_request - from ._request_builders_py3 import build_post503_request - from ._request_builders_py3 import build_delete503_request - from ._request_builders_py3 import build_put504_request - from ._request_builders_py3 import build_patch504_request -except (SyntaxError, ImportError): - from ._request_builders import build_head408_request # type: ignore - from ._request_builders import build_put500_request # type: ignore - from ._request_builders import build_patch500_request # type: ignore - from ._request_builders import build_get502_request # type: ignore - from ._request_builders import build_options502_request # type: ignore - from ._request_builders import build_post503_request # type: ignore - from ._request_builders import build_delete503_request # type: ignore - from ._request_builders import build_put504_request # type: ignore - from ._request_builders import build_patch504_request # type: ignore +from ._request_builders import build_head408_request +from ._request_builders import build_put500_request +from ._request_builders import build_patch500_request +from ._request_builders import build_get502_request +from ._request_builders import build_options502_request +from ._request_builders import build_post503_request +from ._request_builders import build_delete503_request +from ._request_builders import build_put504_request +from ._request_builders import build_patch504_request __all__ = [ "build_head408_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py index 51c03ec520d..4ece9c8d812 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head408_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head408_request(**kwargs: Any) -> HttpRequest: """Return 408 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_head408_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/408" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_put500_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put500_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 500 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -70,29 +58,21 @@ def build_put500_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/500" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch500_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch500_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 500 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -109,29 +89,21 @@ def build_patch500_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/500" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_get502_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get502_request(**kwargs: Any) -> HttpRequest: """Return 502 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -145,26 +117,18 @@ def build_get502_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/502" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_options502_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_options502_request(**kwargs: Any) -> HttpRequest: """Return 502 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -178,26 +142,18 @@ def build_options502_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/502" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="OPTIONS", url=_url, headers=_headers, **kwargs) -def build_post503_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post503_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 503 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -214,29 +170,21 @@ def build_post503_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/503" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_delete503_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete503_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 503 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -253,29 +201,21 @@ def build_delete503_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/503" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) -def build_put504_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put504_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 504 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -292,29 +232,21 @@ def build_put504_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/504" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch504_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch504_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 504 status code, then 200 after retry. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -331,20 +263,15 @@ def build_patch504_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/retry/504" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py deleted file mode 100644 index de8610f02f9..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_retry/_request_builders_py3.py +++ /dev/null @@ -1,359 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head408_request( - **kwargs: Any -) -> HttpRequest: - """Return 408 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/408" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put500_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 500 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/500" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch500_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 500 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/500" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get502_request( - **kwargs: Any -) -> HttpRequest: - """Return 502 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/502" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_options502_request( - **kwargs: Any -) -> HttpRequest: - """Return 502 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/502" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post503_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 503 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/503" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_delete503_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 503 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/503" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_put504_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 504 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/504" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch504_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 504 status code, then 200 after retry. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/retry/504" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/__init__.py index 6c9509398a2..192eb9ee4f4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head501_request - from ._request_builders_py3 import build_get501_request - from ._request_builders_py3 import build_post505_request - from ._request_builders_py3 import build_delete505_request -except (SyntaxError, ImportError): - from ._request_builders import build_head501_request # type: ignore - from ._request_builders import build_get501_request # type: ignore - from ._request_builders import build_post505_request # type: ignore - from ._request_builders import build_delete505_request # type: ignore +from ._request_builders import build_head501_request +from ._request_builders import build_get501_request +from ._request_builders import build_post505_request +from ._request_builders import build_delete505_request __all__ = [ "build_head501_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py index 81820ffc029..57a1dfd3df3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head501_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head501_request(**kwargs: Any) -> HttpRequest: """Return 501 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_head501_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/server/501" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get501_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get501_request(**kwargs: Any) -> HttpRequest: """Return 501 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get501_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/server/501" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_post505_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post505_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 505 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -103,29 +83,21 @@ def build_post505_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/server/505" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_delete505_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete505_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Return 505 status code - should be represented in the client as an error. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -142,20 +114,15 @@ def build_delete505_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/failure/server/505" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py deleted file mode 100644 index a8adfc29d26..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_server_failure/_request_builders_py3.py +++ /dev/null @@ -1,163 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head501_request( - **kwargs: Any -) -> HttpRequest: - """Return 501 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/server/501" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get501_request( - **kwargs: Any -) -> HttpRequest: - """Return 501 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/server/501" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post505_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 505 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/server/505" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_delete505_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Return 505 status code - should be represented in the client as an error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/failure/server/505" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/__init__.py index 6d355239b28..229a3222f9a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/__init__.py @@ -6,46 +6,25 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head200_request - from ._request_builders_py3 import build_get200_request - from ._request_builders_py3 import build_options200_request - from ._request_builders_py3 import build_put200_request - from ._request_builders_py3 import build_patch200_request - from ._request_builders_py3 import build_post200_request - from ._request_builders_py3 import build_delete200_request - from ._request_builders_py3 import build_put201_request - from ._request_builders_py3 import build_post201_request - from ._request_builders_py3 import build_put202_request - from ._request_builders_py3 import build_patch202_request - from ._request_builders_py3 import build_post202_request - from ._request_builders_py3 import build_delete202_request - from ._request_builders_py3 import build_head204_request - from ._request_builders_py3 import build_put204_request - from ._request_builders_py3 import build_patch204_request - from ._request_builders_py3 import build_post204_request - from ._request_builders_py3 import build_delete204_request - from ._request_builders_py3 import build_head404_request -except (SyntaxError, ImportError): - from ._request_builders import build_head200_request # type: ignore - from ._request_builders import build_get200_request # type: ignore - from ._request_builders import build_options200_request # type: ignore - from ._request_builders import build_put200_request # type: ignore - from ._request_builders import build_patch200_request # type: ignore - from ._request_builders import build_post200_request # type: ignore - from ._request_builders import build_delete200_request # type: ignore - from ._request_builders import build_put201_request # type: ignore - from ._request_builders import build_post201_request # type: ignore - from ._request_builders import build_put202_request # type: ignore - from ._request_builders import build_patch202_request # type: ignore - from ._request_builders import build_post202_request # type: ignore - from ._request_builders import build_delete202_request # type: ignore - from ._request_builders import build_head204_request # type: ignore - from ._request_builders import build_put204_request # type: ignore - from ._request_builders import build_patch204_request # type: ignore - from ._request_builders import build_post204_request # type: ignore - from ._request_builders import build_delete204_request # type: ignore - from ._request_builders import build_head404_request # type: ignore +from ._request_builders import build_head200_request +from ._request_builders import build_get200_request +from ._request_builders import build_options200_request +from ._request_builders import build_put200_request +from ._request_builders import build_patch200_request +from ._request_builders import build_post200_request +from ._request_builders import build_delete200_request +from ._request_builders import build_put201_request +from ._request_builders import build_post201_request +from ._request_builders import build_put202_request +from ._request_builders import build_patch202_request +from ._request_builders import build_post202_request +from ._request_builders import build_delete202_request +from ._request_builders import build_head204_request +from ._request_builders import build_put204_request +from ._request_builders import build_patch204_request +from ._request_builders import build_post204_request +from ._request_builders import build_delete204_request +from ._request_builders import build_head404_request __all__ = [ "build_head200_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py index 279012330ce..82829ca3953 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head200_request(**kwargs: Any) -> HttpRequest: """Return 200 status code if successful. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_head200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/200" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_get200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_request(**kwargs: Any) -> HttpRequest: """Get 200 success. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/200" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_options200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_options200_request(**kwargs: Any) -> HttpRequest: """Options 200 success. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,26 +80,18 @@ def build_options200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/200" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="OPTIONS", url=_url, headers=_headers, **kwargs) -def build_put200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put200_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Put boolean value true returning 200 success. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -136,29 +108,21 @@ def build_put200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch200_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Patch true Boolean value in request returning 200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -175,29 +139,21 @@ def build_patch200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_post200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post200_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Post bollean value true in request that returns a 200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -214,29 +170,21 @@ def build_post200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_delete200_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete200_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Delete simple boolean value true returns 200. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -253,29 +201,21 @@ def build_delete200_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/200" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) -def build_put201_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put201_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Put true Boolean value in request returns 201. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -292,29 +232,21 @@ def build_put201_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/201" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_post201_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post201_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Post true Boolean value in request returns 201 (Created). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -331,29 +263,21 @@ def build_post201_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/201" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_put202_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put202_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Put true Boolean value in request returns 202 (Accepted). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -370,29 +294,21 @@ def build_put202_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/202" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch202_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch202_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Patch true Boolean value in request returns 202. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -409,29 +325,21 @@ def build_patch202_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/202" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_post202_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post202_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Post true Boolean value in request returns 202 (Accepted). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -448,29 +356,21 @@ def build_post202_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/202" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_delete202_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete202_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Delete true Boolean value in request returns 202 (accepted). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -487,29 +387,21 @@ def build_delete202_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/202" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) -def build_head204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head204_request(**kwargs: Any) -> HttpRequest: """Return 204 status code if successful. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -523,26 +415,18 @@ def build_head204_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/204" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) -def build_put204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put204_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Put true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -559,29 +443,21 @@ def build_put204_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/204" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_patch204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch204_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Patch true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -598,29 +474,21 @@ def build_patch204_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/204" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) -def build_post204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post204_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Post true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -637,29 +505,21 @@ def build_post204_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/204" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_delete204_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_delete204_request(*, json: bool = True, **kwargs: Any) -> HttpRequest: """Delete true Boolean value in request returns 204 (no content). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -676,29 +536,21 @@ def build_delete204_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/204" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="DELETE", url=_url, headers=_headers, json=json, **kwargs) -def build_head404_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head404_request(**kwargs: Any) -> HttpRequest: """Return 404 status code. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -712,17 +564,12 @@ def build_head404_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/success/404" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py deleted file mode 100644 index 1bc8a31ea45..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/http_success/_request_builders_py3.py +++ /dev/null @@ -1,751 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head200_request( - **kwargs: Any -) -> HttpRequest: - """Return 200 status code if successful. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/200" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_request( - **kwargs: Any -) -> HttpRequest: - """Get 200 success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/200" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_options200_request( - **kwargs: Any -) -> HttpRequest: - """Options 200 success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/200" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="OPTIONS", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put200_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Put boolean value true returning 200 success. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch200_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Patch true Boolean value in request returning 200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post200_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Post bollean value true in request that returns a 200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_delete200_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Delete simple boolean value true returns 200. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/200" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_put201_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Put true Boolean value in request returns 201. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/201" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post201_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Post true Boolean value in request returns 201 (Created). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/201" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_put202_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Put true Boolean value in request returns 202 (Accepted). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/202" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch202_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Patch true Boolean value in request returns 202. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/202" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post202_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Post true Boolean value in request returns 202 (Accepted). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/202" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_delete202_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Delete true Boolean value in request returns 202 (accepted). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/202" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_head204_request( - **kwargs: Any -) -> HttpRequest: - """Return 204 status code if successful. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/204" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put204_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Put true Boolean value in request returns 204 (no content). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/204" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_patch204_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Patch true Boolean value in request returns 204 (no content). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/204" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post204_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Post true Boolean value in request returns 204 (no content). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/204" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_delete204_request( - *, - json: bool = True, - **kwargs: Any -) -> HttpRequest: - """Delete true Boolean value in request returns 204 (no content). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Simple boolean value true. Known values are True and None. Default value is - True. - :paramtype json: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/204" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_head404_request( - **kwargs: Any -) -> HttpRequest: - """Return 404 status code. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/success/404" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="HEAD", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/__init__.py index 6a4f9bc9a49..83f478827e0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/__init__.py @@ -6,76 +6,40 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get200_model204_no_model_default_error200_valid_request - from ._request_builders_py3 import build_get200_model204_no_model_default_error204_valid_request - from ._request_builders_py3 import build_get200_model204_no_model_default_error201_invalid_request - from ._request_builders_py3 import build_get200_model204_no_model_default_error202_none_request - from ._request_builders_py3 import build_get200_model204_no_model_default_error400_valid_request - from ._request_builders_py3 import build_get200_model201_model_default_error200_valid_request - from ._request_builders_py3 import build_get200_model201_model_default_error201_valid_request - from ._request_builders_py3 import build_get200_model201_model_default_error400_valid_request - from ._request_builders_py3 import build_get200_model_a201_model_c404_model_d_default_error200_valid_request - from ._request_builders_py3 import build_get200_model_a201_model_c404_model_d_default_error201_valid_request - from ._request_builders_py3 import build_get200_model_a201_model_c404_model_d_default_error404_valid_request - from ._request_builders_py3 import build_get200_model_a201_model_c404_model_d_default_error400_valid_request - from ._request_builders_py3 import build_get202_none204_none_default_error202_none_request - from ._request_builders_py3 import build_get202_none204_none_default_error204_none_request - from ._request_builders_py3 import build_get202_none204_none_default_error400_valid_request - from ._request_builders_py3 import build_get202_none204_none_default_none202_invalid_request - from ._request_builders_py3 import build_get202_none204_none_default_none204_none_request - from ._request_builders_py3 import build_get202_none204_none_default_none400_none_request - from ._request_builders_py3 import build_get202_none204_none_default_none400_invalid_request - from ._request_builders_py3 import build_get_default_model_a200_valid_request - from ._request_builders_py3 import build_get_default_model_a200_none_request - from ._request_builders_py3 import build_get_default_model_a400_valid_request - from ._request_builders_py3 import build_get_default_model_a400_none_request - from ._request_builders_py3 import build_get_default_none200_invalid_request - from ._request_builders_py3 import build_get_default_none200_none_request - from ._request_builders_py3 import build_get_default_none400_invalid_request - from ._request_builders_py3 import build_get_default_none400_none_request - from ._request_builders_py3 import build_get200_model_a200_none_request - from ._request_builders_py3 import build_get200_model_a200_valid_request - from ._request_builders_py3 import build_get200_model_a200_invalid_request - from ._request_builders_py3 import build_get200_model_a400_none_request - from ._request_builders_py3 import build_get200_model_a400_valid_request - from ._request_builders_py3 import build_get200_model_a400_invalid_request - from ._request_builders_py3 import build_get200_model_a202_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get200_model204_no_model_default_error200_valid_request # type: ignore - from ._request_builders import build_get200_model204_no_model_default_error204_valid_request # type: ignore - from ._request_builders import build_get200_model204_no_model_default_error201_invalid_request # type: ignore - from ._request_builders import build_get200_model204_no_model_default_error202_none_request # type: ignore - from ._request_builders import build_get200_model204_no_model_default_error400_valid_request # type: ignore - from ._request_builders import build_get200_model201_model_default_error200_valid_request # type: ignore - from ._request_builders import build_get200_model201_model_default_error201_valid_request # type: ignore - from ._request_builders import build_get200_model201_model_default_error400_valid_request # type: ignore - from ._request_builders import build_get200_model_a201_model_c404_model_d_default_error200_valid_request # type: ignore - from ._request_builders import build_get200_model_a201_model_c404_model_d_default_error201_valid_request # type: ignore - from ._request_builders import build_get200_model_a201_model_c404_model_d_default_error404_valid_request # type: ignore - from ._request_builders import build_get200_model_a201_model_c404_model_d_default_error400_valid_request # type: ignore - from ._request_builders import build_get202_none204_none_default_error202_none_request # type: ignore - from ._request_builders import build_get202_none204_none_default_error204_none_request # type: ignore - from ._request_builders import build_get202_none204_none_default_error400_valid_request # type: ignore - from ._request_builders import build_get202_none204_none_default_none202_invalid_request # type: ignore - from ._request_builders import build_get202_none204_none_default_none204_none_request # type: ignore - from ._request_builders import build_get202_none204_none_default_none400_none_request # type: ignore - from ._request_builders import build_get202_none204_none_default_none400_invalid_request # type: ignore - from ._request_builders import build_get_default_model_a200_valid_request # type: ignore - from ._request_builders import build_get_default_model_a200_none_request # type: ignore - from ._request_builders import build_get_default_model_a400_valid_request # type: ignore - from ._request_builders import build_get_default_model_a400_none_request # type: ignore - from ._request_builders import build_get_default_none200_invalid_request # type: ignore - from ._request_builders import build_get_default_none200_none_request # type: ignore - from ._request_builders import build_get_default_none400_invalid_request # type: ignore - from ._request_builders import build_get_default_none400_none_request # type: ignore - from ._request_builders import build_get200_model_a200_none_request # type: ignore - from ._request_builders import build_get200_model_a200_valid_request # type: ignore - from ._request_builders import build_get200_model_a200_invalid_request # type: ignore - from ._request_builders import build_get200_model_a400_none_request # type: ignore - from ._request_builders import build_get200_model_a400_valid_request # type: ignore - from ._request_builders import build_get200_model_a400_invalid_request # type: ignore - from ._request_builders import build_get200_model_a202_valid_request # type: ignore +from ._request_builders import build_get200_model204_no_model_default_error200_valid_request +from ._request_builders import build_get200_model204_no_model_default_error204_valid_request +from ._request_builders import build_get200_model204_no_model_default_error201_invalid_request +from ._request_builders import build_get200_model204_no_model_default_error202_none_request +from ._request_builders import build_get200_model204_no_model_default_error400_valid_request +from ._request_builders import build_get200_model201_model_default_error200_valid_request +from ._request_builders import build_get200_model201_model_default_error201_valid_request +from ._request_builders import build_get200_model201_model_default_error400_valid_request +from ._request_builders import build_get200_model_a201_model_c404_model_d_default_error200_valid_request +from ._request_builders import build_get200_model_a201_model_c404_model_d_default_error201_valid_request +from ._request_builders import build_get200_model_a201_model_c404_model_d_default_error404_valid_request +from ._request_builders import build_get200_model_a201_model_c404_model_d_default_error400_valid_request +from ._request_builders import build_get202_none204_none_default_error202_none_request +from ._request_builders import build_get202_none204_none_default_error204_none_request +from ._request_builders import build_get202_none204_none_default_error400_valid_request +from ._request_builders import build_get202_none204_none_default_none202_invalid_request +from ._request_builders import build_get202_none204_none_default_none204_none_request +from ._request_builders import build_get202_none204_none_default_none400_none_request +from ._request_builders import build_get202_none204_none_default_none400_invalid_request +from ._request_builders import build_get_default_model_a200_valid_request +from ._request_builders import build_get_default_model_a200_none_request +from ._request_builders import build_get_default_model_a400_valid_request +from ._request_builders import build_get_default_model_a400_none_request +from ._request_builders import build_get_default_none200_invalid_request +from ._request_builders import build_get_default_none200_none_request +from ._request_builders import build_get_default_none400_invalid_request +from ._request_builders import build_get_default_none400_none_request +from ._request_builders import build_get200_model_a200_none_request +from ._request_builders import build_get200_model_a200_valid_request +from ._request_builders import build_get200_model_a200_invalid_request +from ._request_builders import build_get200_model_a400_none_request +from ._request_builders import build_get200_model_a400_valid_request +from ._request_builders import build_get200_model_a400_invalid_request +from ._request_builders import build_get200_model_a202_valid_request __all__ = [ "build_get200_model204_no_model_default_error200_valid_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py index a417426e704..3a85f191dd5 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get200_model204_no_model_default_error200_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model204_no_model_default_error200_valid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with valid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,26 +30,18 @@ def build_get200_model204_no_model_default_error200_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/204/none/default/Error/response/200/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model204_no_model_default_error204_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model204_no_model_default_error204_valid_request(**kwargs: Any) -> HttpRequest: """Send a 204 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -67,26 +55,18 @@ def build_get200_model204_no_model_default_error204_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/204/none/default/Error/response/204/none" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model204_no_model_default_error201_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model204_no_model_default_error201_invalid_request(**kwargs: Any) -> HttpRequest: """Send a 201 response with valid payload: {'statusCode': '201'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -100,26 +80,18 @@ def build_get200_model204_no_model_default_error201_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/204/none/default/Error/response/201/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model204_no_model_default_error202_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model204_no_model_default_error202_none_request(**kwargs: Any) -> HttpRequest: """Send a 202 response with no payload:. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -133,26 +105,18 @@ def build_get200_model204_no_model_default_error202_none_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/204/none/default/Error/response/202/none" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model204_no_model_default_error400_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model204_no_model_default_error400_valid_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -166,26 +130,18 @@ def build_get200_model204_no_model_default_error400_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/204/none/default/Error/response/400/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model201_model_default_error200_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model201_model_default_error200_valid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with valid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -199,26 +155,18 @@ def build_get200_model201_model_default_error200_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/201/B/default/Error/response/200/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model201_model_default_error201_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model201_model_default_error201_valid_request(**kwargs: Any) -> HttpRequest: """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -232,26 +180,18 @@ def build_get200_model201_model_default_error201_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/201/B/default/Error/response/201/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model201_model_default_error400_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model201_model_default_error400_valid_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -265,26 +205,18 @@ def build_get200_model201_model_default_error400_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/201/B/default/Error/response/400/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a201_model_c404_model_d_default_error200_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a201_model_c404_model_d_default_error200_valid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with valid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -298,26 +230,18 @@ def build_get200_model_a201_model_c404_model_d_default_error200_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a201_model_c404_model_d_default_error201_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a201_model_c404_model_d_default_error201_valid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with valid payload: {'httpCode': '201'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -331,26 +255,18 @@ def build_get200_model_a201_model_c404_model_d_default_error201_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a201_model_c404_model_d_default_error404_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a201_model_c404_model_d_default_error404_valid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with valid payload: {'httpStatusCode': '404'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -364,26 +280,18 @@ def build_get200_model_a201_model_c404_model_d_default_error404_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a201_model_c404_model_d_default_error400_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a201_model_c404_model_d_default_error400_valid_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -397,26 +305,18 @@ def build_get200_model_a201_model_c404_model_d_default_error400_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get202_none204_none_default_error202_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get202_none204_none_default_error202_none_request(**kwargs: Any) -> HttpRequest: """Send a 202 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -430,26 +330,18 @@ def build_get202_none204_none_default_error202_none_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/202/none/204/none/default/Error/response/202/none" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get202_none204_none_default_error204_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get202_none204_none_default_error204_none_request(**kwargs: Any) -> HttpRequest: """Send a 204 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -463,26 +355,18 @@ def build_get202_none204_none_default_error204_none_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/202/none/204/none/default/Error/response/204/none" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get202_none204_none_default_error400_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get202_none204_none_default_error400_valid_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -496,26 +380,18 @@ def build_get202_none204_none_default_error400_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/202/none/204/none/default/Error/response/400/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get202_none204_none_default_none202_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get202_none204_none_default_none202_invalid_request(**kwargs: Any) -> HttpRequest: """Send a 202 response with an unexpected payload {'property': 'value'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -530,17 +406,10 @@ def build_get202_none204_none_default_none202_invalid_request( # Construct URL _url = "/http/payloads/202/none/204/none/default/none/response/202/invalid" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get202_none204_none_default_none204_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get202_none204_none_default_none204_none_request(**kwargs: Any) -> HttpRequest: """Send a 204 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -555,17 +424,10 @@ def build_get202_none204_none_default_none204_none_request( # Construct URL _url = "/http/payloads/202/none/204/none/default/none/response/204/none" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get202_none204_none_default_none400_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get202_none204_none_default_none400_none_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -580,17 +442,10 @@ def build_get202_none204_none_default_none400_none_request( # Construct URL _url = "/http/payloads/202/none/204/none/default/none/response/400/none" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get202_none204_none_default_none400_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get202_none204_none_default_none400_invalid_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with an unexpected payload {'property': 'value'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -605,17 +460,10 @@ def build_get202_none204_none_default_none400_invalid_request( # Construct URL _url = "/http/payloads/202/none/204/none/default/none/response/400/invalid" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get_default_model_a200_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_default_model_a200_valid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with valid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -629,26 +477,18 @@ def build_get_default_model_a200_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/default/A/response/200/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_default_model_a200_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_default_model_a200_none_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -662,26 +502,18 @@ def build_get_default_model_a200_none_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/default/A/response/200/none" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_default_model_a400_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_default_model_a400_valid_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with valid payload: {'statusCode': '400'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -695,26 +527,18 @@ def build_get_default_model_a400_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/default/A/response/400/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_default_model_a400_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_default_model_a400_none_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -728,26 +552,18 @@ def build_get_default_model_a400_none_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/default/A/response/400/none" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_default_none200_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_default_none200_invalid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with invalid payload: {'statusCode': '200'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -762,17 +578,10 @@ def build_get_default_none200_invalid_request( # Construct URL _url = "/http/payloads/default/none/response/200/invalid" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get_default_none200_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_default_none200_none_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -787,17 +596,10 @@ def build_get_default_none200_none_request( # Construct URL _url = "/http/payloads/default/none/response/200/none" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get_default_none400_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_default_none400_invalid_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with valid payload: {'statusCode': '400'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -812,17 +614,10 @@ def build_get_default_none400_invalid_request( # Construct URL _url = "/http/payloads/default/none/response/400/invalid" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get_default_none400_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_default_none400_none_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with no payload. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -837,17 +632,10 @@ def build_get_default_none400_none_request( # Construct URL _url = "/http/payloads/default/none/response/400/none" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get200_model_a200_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a200_none_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with no payload, when a payload is expected - client should return a null object of thde type for model A. @@ -862,26 +650,18 @@ def build_get200_model_a200_none_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/response/200/none" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a200_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a200_valid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with payload {'statusCode': '200'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -895,26 +675,18 @@ def build_get200_model_a200_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/response/200/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a200_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a200_invalid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -928,26 +700,18 @@ def build_get200_model_a200_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/response/200/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a400_none_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a400_none_request(**kwargs: Any) -> HttpRequest: """Send a 400 response with no payload client should treat as an http error with no error model. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -961,26 +725,18 @@ def build_get200_model_a400_none_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/response/400/none" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a400_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a400_valid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with payload {'statusCode': '400'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -994,26 +750,18 @@ def build_get200_model_a400_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/response/400/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a400_invalid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a400_invalid_request(**kwargs: Any) -> HttpRequest: """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1027,26 +775,18 @@ def build_get200_model_a400_invalid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/response/400/invalid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get200_model_a202_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get200_model_a202_valid_request(**kwargs: Any) -> HttpRequest: """Send a 202 response with payload {'statusCode': '202'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1060,17 +800,12 @@ def build_get200_model_a202_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/http/payloads/200/A/response/202/valid" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py deleted file mode 100644 index 8d3a35c63d7..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/HttpLowLevel/httpinfrastructurelowlevel/rest/multiple_responses/_request_builders_py3.py +++ /dev/null @@ -1,1042 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get200_model204_no_model_default_error200_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with valid payload: {'statusCode': '200'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/204/none/default/Error/response/200/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model204_no_model_default_error204_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 204 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/204/none/default/Error/response/204/none" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model204_no_model_default_error201_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 201 response with valid payload: {'statusCode': '201'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/204/none/default/Error/response/201/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model204_no_model_default_error202_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 202 response with no payload:. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/204/none/default/Error/response/202/none" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model204_no_model_default_error400_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with valid error payload: {'status': 400, 'message': 'client error'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/204/none/default/Error/response/400/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model201_model_default_error200_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with valid payload: {'statusCode': '200'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/201/B/default/Error/response/200/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model201_model_default_error201_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 201 response with valid payload: {'statusCode': '201', 'textStatusCode': 'Created'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/201/B/default/Error/response/201/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model201_model_default_error400_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/201/B/default/Error/response/400/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a201_model_c404_model_d_default_error200_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with valid payload: {'statusCode': '200'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/201/C/404/D/default/Error/response/200/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a201_model_c404_model_d_default_error201_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with valid payload: {'httpCode': '201'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/201/C/404/D/default/Error/response/201/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a201_model_c404_model_d_default_error404_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with valid payload: {'httpStatusCode': '404'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/201/C/404/D/default/Error/response/404/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a201_model_c404_model_d_default_error400_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/201/C/404/D/default/Error/response/400/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get202_none204_none_default_error202_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 202 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/202/none/204/none/default/Error/response/202/none" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get202_none204_none_default_error204_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 204 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/202/none/204/none/default/Error/response/204/none" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get202_none204_none_default_error400_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with valid payload: {'code': '400', 'message': 'client error'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/202/none/204/none/default/Error/response/400/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get202_none204_none_default_none202_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 202 response with an unexpected payload {'property': 'value'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/payloads/202/none/204/none/default/none/response/202/invalid" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get202_none204_none_default_none204_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 204 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/payloads/202/none/204/none/default/none/response/204/none" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get202_none204_none_default_none400_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/payloads/202/none/204/none/default/none/response/400/none" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get202_none204_none_default_none400_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with an unexpected payload {'property': 'value'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/payloads/202/none/204/none/default/none/response/400/invalid" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get_default_model_a200_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with valid payload: {'statusCode': '200'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/default/A/response/200/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_default_model_a200_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/default/A/response/200/none" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_default_model_a400_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with valid payload: {'statusCode': '400'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/default/A/response/400/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_default_model_a400_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/default/A/response/400/none" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_default_none200_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with invalid payload: {'statusCode': '200'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/payloads/default/none/response/200/invalid" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get_default_none200_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/payloads/default/none/response/200/none" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get_default_none400_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with valid payload: {'statusCode': '400'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/payloads/default/none/response/400/invalid" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get_default_none400_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with no payload. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/http/payloads/default/none/response/400/none" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get200_model_a200_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with no payload, when a payload is expected - client should return a null - object of thde type for model A. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/response/200/none" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a200_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with payload {'statusCode': '200'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/response/200/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a200_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with invalid payload {'statusCodeInvalid': '200'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/response/200/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a400_none_request( - **kwargs: Any -) -> HttpRequest: - """Send a 400 response with no payload client should treat as an http error with no error model. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/response/400/none" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a400_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with payload {'statusCode': '400'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/response/400/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a400_invalid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 200 response with invalid payload {'statusCodeInvalid': '400'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/response/400/invalid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get200_model_a202_valid_request( - **kwargs: Any -) -> HttpRequest: - """Send a 202 response with payload {'statusCode': '202'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/http/payloads/200/A/response/202/valid" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_client.py index 28079764760..79b68f232c7 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/_client.py @@ -29,7 +29,6 @@ class IncorrectReturnedErrorModel: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = IncorrectReturnedErrorModelConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/__init__.py index dc1410e2374..3acb65b5a9c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_incorrect_error_from_server_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_incorrect_error_from_server_request # type: ignore +from ._request_builders import build_get_incorrect_error_from_server_request __all__ = [ "build_get_incorrect_error_from_server_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders.py index 865e99301d1..544576d101e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders.py @@ -14,12 +14,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_incorrect_error_from_server_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_incorrect_error_from_server_request(**kwargs: Any) -> HttpRequest: """Get an error response from the server that is not as described in our Error object. Want to swallow the deserialization error and still return an HttpResponseError to the users. @@ -35,8 +31,4 @@ def build_get_incorrect_error_from_server_request( # Construct URL _url = "/incorrectError" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 17d39f0d0db..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/IncorrectErrorResponseLowLevel/incorrecterrorresponselowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest - -from .._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_incorrect_error_from_server_request( - **kwargs: Any -) -> HttpRequest: - """Get an error response from the server that is not as described in our Error object. Want to - swallow the deserialization error and still return an HttpResponseError to the users. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/incorrectError" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_client.py index 7f66756c22b..ea74b1045f9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/_client.py @@ -28,7 +28,6 @@ class MediaTypesClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = MediaTypesClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py index 9486a1d36b8..1c9162a396e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/__init__.py @@ -6,20 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_analyze_body_request - from ._request_builders_py3 import build_analyze_body_no_accept_header_request - from ._request_builders_py3 import build_content_type_with_encoding_request - from ._request_builders_py3 import build_binary_body_with_two_content_types_request - from ._request_builders_py3 import build_binary_body_with_three_content_types_request - from ._request_builders_py3 import build_put_text_and_json_body_request -except (SyntaxError, ImportError): - from ._request_builders import build_analyze_body_request # type: ignore - from ._request_builders import build_analyze_body_no_accept_header_request # type: ignore - from ._request_builders import build_content_type_with_encoding_request # type: ignore - from ._request_builders import build_binary_body_with_two_content_types_request # type: ignore - from ._request_builders import build_binary_body_with_three_content_types_request # type: ignore - from ._request_builders import build_put_text_and_json_body_request # type: ignore +from ._request_builders import build_analyze_body_request +from ._request_builders import build_analyze_body_no_accept_header_request +from ._request_builders import build_content_type_with_encoding_request +from ._request_builders import build_binary_body_with_two_content_types_request +from ._request_builders import build_binary_body_with_three_content_types_request +from ._request_builders import build_put_text_and_json_body_request __all__ = [ "build_analyze_body_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py index 981f441f6f8..f3549294c36 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders.py @@ -22,13 +22,11 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload def build_analyze_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Analyze body, that could be different media types. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -55,10 +53,7 @@ def build_analyze_body_request( @overload -def build_analyze_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_analyze_body_request(*, content_type: str, content: Optional[IO] = None, **kwargs: Any) -> HttpRequest: """Analyze body, that could be different media types. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -77,10 +72,7 @@ def build_analyze_body_request( """ -def build_analyze_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_analyze_body_request(**kwargs: Any) -> HttpRequest: """Analyze body, that could be different media types. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -99,30 +91,24 @@ def build_analyze_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/mediatypes/analyze" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_analyze_body_no_accept_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. @@ -151,9 +137,8 @@ def build_analyze_body_no_accept_header_request( @overload def build_analyze_body_no_accept_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: str, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. @@ -173,10 +158,7 @@ def build_analyze_body_no_accept_header_request( """ -def build_analyze_body_no_accept_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_analyze_body_no_accept_header_request(**kwargs: Any) -> HttpRequest: """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept type. @@ -196,26 +178,18 @@ def build_analyze_body_no_accept_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/mediatypes/analyzeNoAccept" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_content_type_with_encoding_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_content_type_with_encoding_request(*, content: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Pass in contentType 'text/plain; charset=UTF-8' to pass test. Value for input does not matter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -231,29 +205,21 @@ def build_content_type_with_encoding_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/mediatypes/contentTypeWithEncoding" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, content=content, **kwargs) -def build_binary_body_with_two_content_types_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_binary_body_with_two_content_types_request(*, content: IO, **kwargs: Any) -> HttpRequest: """Binary body with two content types. Pass in of {'hello': 'world'} for the application/json content type, and a byte stream of 'hello, world!' for application/octet-stream. @@ -270,29 +236,21 @@ def build_binary_body_with_two_content_types_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "text/plain") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "text/plain") # Construct URL _url = "/mediatypes/binaryBodyTwoContentTypes" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, content=content, **kwargs) -def build_binary_body_with_three_content_types_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_binary_body_with_three_content_types_request(*, content: IO, **kwargs: Any) -> HttpRequest: """Binary body with three content types. Pass in string 'hello, world' with content type 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for 'application/octet-stream'. @@ -310,29 +268,21 @@ def build_binary_body_with_three_content_types_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "text/plain") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "text/plain") # Construct URL _url = "/mediatypes/binaryBodyThreeContentTypes" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, content=content, **kwargs) -def build_put_text_and_json_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_text_and_json_body_request(*, content: str, **kwargs: Any) -> HttpRequest: """Body that's either text/plain or application/json. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -348,20 +298,15 @@ def build_put_text_and_json_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "text/plain") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "text/plain") # Construct URL _url = "/mediatypes/textAndJson" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 8a8336d93e7..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MediaTypesLowLevel/mediatypeslowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,381 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_analyze_body_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Analyze body, that could be different media types. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Input parameter. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "source": "str" # Optional. File source path. - } - """ - - -@overload -def build_analyze_body_request( - *, - content_type: str, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Analyze body, that could be different media types. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'application/pdf', 'image/jpeg', 'image/png', - 'image/tiff'. Required. - :paramtype content_type: str - :keyword content: Input parameter. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_analyze_body_request( - **kwargs: Any -) -> HttpRequest: - """Analyze body, that could be different media types. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff'. Default value is None. - :paramtype content_type: str - :keyword json: Input parameter. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/mediatypes/analyze" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_analyze_body_no_accept_header_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept - type. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Input parameter. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "source": "str" # Optional. File source path. - } - """ - - -@overload -def build_analyze_body_no_accept_header_request( - *, - content_type: str, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept - type. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Known values are: 'application/json', 'application/pdf', 'image/jpeg', 'image/png', - 'image/tiff'. Required. - :paramtype content_type: str - :keyword content: Input parameter. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_analyze_body_no_accept_header_request( - **kwargs: Any -) -> HttpRequest: - """Analyze body, that could be different media types. Adds to AnalyzeBody by not having an accept - type. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json', - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff'. Default value is None. - :paramtype content_type: str - :keyword json: Input parameter. Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/mediatypes/analyzeNoAccept" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_content_type_with_encoding_request( - *, - content: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Pass in contentType 'text/plain; charset=UTF-8' to pass test. Value for input does not matter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Input parameter. Default value is None. - :paramtype content: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/mediatypes/contentTypeWithEncoding" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_binary_body_with_two_content_types_request( - *, - content: IO, - **kwargs: Any -) -> HttpRequest: - """Binary body with two content types. Pass in of {'hello': 'world'} for the application/json - content type, and a byte stream of 'hello, world!' for application/octet-stream. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: The payload body. Required. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "text/plain") - - # Construct URL - _url = "/mediatypes/binaryBodyTwoContentTypes" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_binary_body_with_three_content_types_request( - *, - content: IO, - **kwargs: Any -) -> HttpRequest: - """Binary body with three content types. Pass in string 'hello, world' with content type - 'text/plain', {'hello': world'} with content type 'application/json' and a byte string for - 'application/octet-stream'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: The payload body. Required. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "text/plain") - - # Construct URL - _url = "/mediatypes/binaryBodyThreeContentTypes" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_put_text_and_json_body_request( - *, - content: str, - **kwargs: Any -) -> HttpRequest: - """Body that's either text/plain or application/json. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: The payload body. Required. - :paramtype content: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "text/plain") - - # Construct URL - _url = "/mediatypes/textAndJson" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - content=content, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_client.py index 473c948b74a..7d9dbffb112 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/_client.py @@ -28,7 +28,6 @@ class MergePatchJsonClient: # pylint: disable=client-accepts-api-version-keywor """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = MergePatchJsonClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/__init__.py index aa5ee9fff29..55d58fa832d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_patch_single_request -except (SyntaxError, ImportError): - from ._request_builders import build_patch_single_request # type: ignore +from ._request_builders import build_patch_single_request __all__ = [ "build_patch_single_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders.py index f786e9ac481..d1a88b6b4b0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_patch_single_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_patch_single_request(*, json: JSON, **kwargs: Any) -> HttpRequest: """Basic patch with an object. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -43,20 +39,15 @@ def build_patch_single_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/mergePatchJson/single" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, headers=_headers, json=json, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 1cfb7effeee..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MergePatchJsonLowLevel/mergepatchjsonlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_patch_single_request( - *, - json: JSON, - **kwargs: Any -) -> HttpRequest: - """Basic patch with an object. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Pass in {'foo': 'bar'} for a 200, anything else for an object error. Required. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/mergePatchJson/single" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - json=json, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_client.py index 065949a57d2..f8ad89a94d4 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestResourceFlatteningTestService: # pylint: disable=client-accepts-a """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestResourceFlatteningTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/__init__.py index f56a51a7756..47ca70c60b9 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/__init__.py @@ -6,30 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put_array_request - from ._request_builders_py3 import build_get_array_request - from ._request_builders_py3 import build_put_wrapped_array_request - from ._request_builders_py3 import build_get_wrapped_array_request - from ._request_builders_py3 import build_put_dictionary_request - from ._request_builders_py3 import build_get_dictionary_request - from ._request_builders_py3 import build_put_resource_collection_request - from ._request_builders_py3 import build_get_resource_collection_request - from ._request_builders_py3 import build_put_simple_product_request - from ._request_builders_py3 import build_post_flattened_simple_product_request - from ._request_builders_py3 import build_put_simple_product_with_grouping_request -except (SyntaxError, ImportError): - from ._request_builders import build_put_array_request # type: ignore - from ._request_builders import build_get_array_request # type: ignore - from ._request_builders import build_put_wrapped_array_request # type: ignore - from ._request_builders import build_get_wrapped_array_request # type: ignore - from ._request_builders import build_put_dictionary_request # type: ignore - from ._request_builders import build_get_dictionary_request # type: ignore - from ._request_builders import build_put_resource_collection_request # type: ignore - from ._request_builders import build_get_resource_collection_request # type: ignore - from ._request_builders import build_put_simple_product_request # type: ignore - from ._request_builders import build_post_flattened_simple_product_request # type: ignore - from ._request_builders import build_put_simple_product_with_grouping_request # type: ignore +from ._request_builders import build_put_array_request +from ._request_builders import build_get_array_request +from ._request_builders import build_put_wrapped_array_request +from ._request_builders import build_get_wrapped_array_request +from ._request_builders import build_put_dictionary_request +from ._request_builders import build_get_dictionary_request +from ._request_builders import build_put_resource_collection_request +from ._request_builders import build_get_resource_collection_request +from ._request_builders import build_put_simple_product_request +from ._request_builders import build_post_flattened_simple_product_request +from ._request_builders import build_put_simple_product_with_grouping_request __all__ = [ "build_put_array_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py index 51dd3aa4968..18859b0eb6c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders.py @@ -23,13 +23,11 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload def build_put_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[List[JSON]] = None, **kwargs: Any +) -> HttpRequest: """Put External Resource as an Array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -65,9 +63,8 @@ def build_put_array_request( @overload def build_put_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Put External Resource as an Array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -85,10 +82,7 @@ def build_put_array_request( """ -def build_put_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_array_request(**kwargs: Any) -> HttpRequest: """Put External Resource as an Array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -108,29 +102,21 @@ def build_put_array_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/array" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_array_request(**kwargs: Any) -> HttpRequest: """Get External Resource as an Array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -144,27 +130,21 @@ def build_get_array_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/array" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_wrapped_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[List[JSON]] = None, **kwargs: Any +) -> HttpRequest: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -195,9 +175,8 @@ def build_put_wrapped_array_request( @overload def build_put_wrapped_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -216,10 +195,7 @@ def build_put_wrapped_array_request( """ -def build_put_wrapped_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_wrapped_array_request(**kwargs: Any) -> HttpRequest: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -240,29 +216,21 @@ def build_put_wrapped_array_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/wrappedarray" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_wrapped_array_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_wrapped_array_request(**kwargs: Any) -> HttpRequest: """No need to have a route in Express server for this operation. Used to verify the type flattened is not removed if it's referenced in an array. @@ -277,27 +245,21 @@ def build_get_wrapped_array_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/wrappedarray" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_dictionary_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[Dict[str, JSON]] = None, **kwargs: Any +) -> HttpRequest: """Put External Resource as a Dictionary. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -341,9 +303,8 @@ def build_put_dictionary_request( @overload def build_put_dictionary_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Put External Resource as a Dictionary. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -361,10 +322,7 @@ def build_put_dictionary_request( """ -def build_put_dictionary_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_dictionary_request(**kwargs: Any) -> HttpRequest: """Put External Resource as a Dictionary. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -384,29 +342,21 @@ def build_put_dictionary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/dictionary" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_dictionary_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_dictionary_request(**kwargs: Any) -> HttpRequest: """Get External Resource as a Dictionary. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -420,27 +370,21 @@ def build_get_dictionary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/dictionary" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_resource_collection_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Put External Resource as a ResourceCollection. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -529,9 +473,8 @@ def build_put_resource_collection_request( @overload def build_put_resource_collection_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Put External Resource as a ResourceCollection. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -549,10 +492,7 @@ def build_put_resource_collection_request( """ -def build_put_resource_collection_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_resource_collection_request(**kwargs: Any) -> HttpRequest: """Put External Resource as a ResourceCollection. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -572,29 +512,21 @@ def build_put_resource_collection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/resourcecollection" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_resource_collection_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_resource_collection_request(**kwargs: Any) -> HttpRequest: """Get External Resource as a ResourceCollection. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -608,27 +540,21 @@ def build_get_resource_collection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/resourcecollection" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload def build_put_simple_product_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Put Simple Product with client flattening true on the model. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -669,9 +595,8 @@ def build_put_simple_product_request( @overload def build_put_simple_product_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Put Simple Product with client flattening true on the model. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -689,10 +614,7 @@ def build_put_simple_product_request( """ -def build_put_simple_product_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_simple_product_request(**kwargs: Any) -> HttpRequest: """Put Simple Product with client flattening true on the model. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -712,30 +634,24 @@ def build_put_simple_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/customFlattening" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) @overload def build_post_flattened_simple_product_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Put Flattened Simple Product with client flattening true on the parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -776,9 +692,8 @@ def build_post_flattened_simple_product_request( @overload def build_post_flattened_simple_product_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Put Flattened Simple Product with client flattening true on the parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -796,10 +711,7 @@ def build_post_flattened_simple_product_request( """ -def build_post_flattened_simple_product_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_flattened_simple_product_request(**kwargs: Any) -> HttpRequest: """Put Flattened Simple Product with client flattening true on the parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -819,31 +731,24 @@ def build_post_flattened_simple_product_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/customFlattening" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_put_simple_product_with_grouping_request( - name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + name: str, *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Put Simple Product with client flattening true on the model. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -886,10 +791,8 @@ def build_put_simple_product_with_grouping_request( @overload def build_put_simple_product_with_grouping_request( - name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + name: str, *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Put Simple Product with client flattening true on the model. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -909,11 +812,7 @@ def build_put_simple_product_with_grouping_request( """ -def build_put_simple_product_with_grouping_request( - name, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_simple_product_with_grouping_request(name: str, **kwargs: Any) -> HttpRequest: """Put Simple Product with client flattening true on the model. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -935,25 +834,20 @@ def build_put_simple_product_with_grouping_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/model-flatten/customFlattening/parametergrouping/{name}/" path_format_arguments = { - "name": _SERIALIZER.url("name", name, 'str'), + "name": _SERIALIZER.url("name", name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 8143ba31d04..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ModelFlatteningLowLevel/modelflatteninglowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,976 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Dict, IO, List, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer -from .._vendor import _format_url_section - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_put_array_request( - *, - content_type: Optional[str] = None, - json: Optional[List[JSON]] = None, - **kwargs: Any -) -> HttpRequest: - """Put External Resource as an Array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: External Resource as an Array to put. Default value is None. - :paramtype json: list[JSON] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - ] - """ - - -@overload -def build_put_array_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Put External Resource as an Array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: External Resource as an Array to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_array_request( - **kwargs: Any -) -> HttpRequest: - """Put External Resource as an Array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: External Resource as an Array to put. Is either a list type or a IO type. - Default value is None. - :paramtype json: list[JSON] or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/array" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_array_request( - **kwargs: Any -) -> HttpRequest: - """Get External Resource as an Array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/array" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_wrapped_array_request( - *, - content_type: Optional[str] = None, - json: Optional[List[JSON]] = None, - **kwargs: Any -) -> HttpRequest: - """No need to have a route in Express server for this operation. Used to verify the type flattened - is not removed if it's referenced in an array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: External Resource as an Array to put. Default value is None. - :paramtype json: list[JSON] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - { - "value": "str" # Optional. the product value. - } - ] - """ - - -@overload -def build_put_wrapped_array_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """No need to have a route in Express server for this operation. Used to verify the type flattened - is not removed if it's referenced in an array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: External Resource as an Array to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_wrapped_array_request( - **kwargs: Any -) -> HttpRequest: - """No need to have a route in Express server for this operation. Used to verify the type flattened - is not removed if it's referenced in an array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: External Resource as an Array to put. Is either a list type or a IO type. - Default value is None. - :paramtype json: list[JSON] or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/wrappedarray" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_wrapped_array_request( - **kwargs: Any -) -> HttpRequest: - """No need to have a route in Express server for this operation. Used to verify the type flattened - is not removed if it's referenced in an array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/wrappedarray" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_dictionary_request( - *, - content_type: Optional[str] = None, - json: Optional[Dict[str, JSON]] = None, - **kwargs: Any -) -> HttpRequest: - """Put External Resource as a Dictionary. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: External Resource as a Dictionary to put. Default value is None. - :paramtype json: dict[str, JSON] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "str": { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "p.name": "str", # Optional. - "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Known values - are: "Succeeded", "Failed", "canceled", "Accepted", "Creating", - "Created", "Updating", "Updated", "Deleting", "Deleted", and "OK". - "type": "str" # Optional. - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - } - """ - - -@overload -def build_put_dictionary_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Put External Resource as a Dictionary. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: External Resource as a Dictionary to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_dictionary_request( - **kwargs: Any -) -> HttpRequest: - """Put External Resource as a Dictionary. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: External Resource as a Dictionary to put. Is either a dict type or a IO type. - Default value is None. - :paramtype json: dict[str, JSON] or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/dictionary" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_dictionary_request( - **kwargs: Any -) -> HttpRequest: - """Get External Resource as a Dictionary. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/dictionary" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_resource_collection_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Put External Resource as a ResourceCollection. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: External Resource as a ResourceCollection to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "arrayofresources": [ - { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "p.name": "str", # Optional. - "provisioningState": "str", # Optional. - "provisioningStateValues": "str", # Optional. Known - values are: "Succeeded", "Failed", "canceled", "Accepted", - "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", - and "OK". - "type": "str" # Optional. - }, - "tags": { - "str": "str" # Optional. Dictionary of - :code:``. - }, - "type": "str" # Optional. Resource Type. - } - ], - "dictionaryofresources": { - "str": { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "p.name": "str", # Optional. Dictionary of - :code:``. - "provisioningState": "str", # Optional. Dictionary - of :code:``. - "provisioningStateValues": "str", # Optional. Known - values are: "Succeeded", "Failed", "canceled", "Accepted", - "Creating", "Created", "Updating", "Updated", "Deleting", "Deleted", - and "OK". - "type": "str" # Optional. Dictionary of - :code:``. - }, - "tags": { - "str": "str" # Optional. Dictionary of - :code:``. - }, - "type": "str" # Optional. Resource Type. - } - }, - "productresource": { - "id": "str", # Optional. Resource Id. - "location": "str", # Optional. Resource Location. - "name": "str", # Optional. Resource Name. - "properties": { - "p.name": "str", # Optional. Flattened product. - "provisioningState": "str", # Optional. Flattened product. - "provisioningStateValues": "str", # Optional. Known values - are: "Succeeded", "Failed", "canceled", "Accepted", "Creating", - "Created", "Updating", "Updated", "Deleting", "Deleted", and "OK". - "type": "str" # Optional. Flattened product. - }, - "tags": { - "str": "str" # Optional. Dictionary of :code:``. - }, - "type": "str" # Optional. Resource Type. - } - } - """ - - -@overload -def build_put_resource_collection_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Put External Resource as a ResourceCollection. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: External Resource as a ResourceCollection to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_resource_collection_request( - **kwargs: Any -) -> HttpRequest: - """Put External Resource as a ResourceCollection. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: External Resource as a ResourceCollection to put. Is either a model type or a IO - type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/resourcecollection" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_resource_collection_request( - **kwargs: Any -) -> HttpRequest: - """Get External Resource as a ResourceCollection. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/resourcecollection" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_simple_product_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Put Simple Product with client flattening true on the model. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Simple body product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Unique identifier representing a specific - product for a given latitude & longitude. For example, uberX in San Francisco - will have a different product_id than uberX in Los Angeles. Required. - "details": { - "max_product_capacity": "Large", # Default value is "Large". - Capacity of product. For example, 4 people. Required. - "max_product_display_name": "str", # Display name of product. - Required. - "max_product_image": { - "@odata.value": "str", # Optional. URL value. - "generic_value": "str" # Optional. Generic URL value. - } - } - } - """ - - -@overload -def build_put_simple_product_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Put Simple Product with client flattening true on the model. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Simple body product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_simple_product_request( - **kwargs: Any -) -> HttpRequest: - """Put Simple Product with client flattening true on the model. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Simple body product to put. Is either a model type or a IO type. Default value - is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/customFlattening" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_flattened_simple_product_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Put Flattened Simple Product with client flattening true on the parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Simple body product to post. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Unique identifier representing a specific - product for a given latitude & longitude. For example, uberX in San Francisco - will have a different product_id than uberX in Los Angeles. Required. - "details": { - "max_product_capacity": "Large", # Default value is "Large". - Capacity of product. For example, 4 people. Required. - "max_product_display_name": "str", # Display name of product. - Required. - "max_product_image": { - "@odata.value": "str", # Optional. URL value. - "generic_value": "str" # Optional. Generic URL value. - } - } - } - """ - - -@overload -def build_post_flattened_simple_product_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Put Flattened Simple Product with client flattening true on the parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Simple body product to post. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_flattened_simple_product_request( - **kwargs: Any -) -> HttpRequest: - """Put Flattened Simple Product with client flattening true on the parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Simple body product to post. Is either a model type or a IO type. Default value - is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/customFlattening" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_simple_product_with_grouping_request( - name: str, - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Put Simple Product with client flattening true on the model. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param name: Product name with value 'groupproduct'. Required. - :type name: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Simple body product to put. Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "base_product_description": "str", # Optional. Description of product. - "base_product_id": "str", # Unique identifier representing a specific - product for a given latitude & longitude. For example, uberX in San Francisco - will have a different product_id than uberX in Los Angeles. Required. - "details": { - "max_product_capacity": "Large", # Default value is "Large". - Capacity of product. For example, 4 people. Required. - "max_product_display_name": "str", # Display name of product. - Required. - "max_product_image": { - "@odata.value": "str", # Optional. URL value. - "generic_value": "str" # Optional. Generic URL value. - } - } - } - """ - - -@overload -def build_put_simple_product_with_grouping_request( - name: str, - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Put Simple Product with client flattening true on the model. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param name: Product name with value 'groupproduct'. Required. - :type name: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Simple body product to put. Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_simple_product_with_grouping_request( - name: str, - **kwargs: Any -) -> HttpRequest: - """Put Simple Product with client flattening true on the model. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param name: Product name with value 'groupproduct'. Required. - :type name: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Simple body product to put. Is either a model type or a IO type. Default value - is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/model-flatten/customFlattening/parametergrouping/{name}/" - path_format_arguments = { - "name": _SERIALIZER.url("name", name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_client.py index 6b053f65891..83f160039cf 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/_client.py @@ -28,7 +28,6 @@ class MultipleInheritanceServiceClient: # pylint: disable=client-accepts-api-ve """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/__init__.py index 007cd269e83..225e03c63e1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/__init__.py @@ -6,28 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_horse_request - from ._request_builders_py3 import build_put_horse_request - from ._request_builders_py3 import build_get_pet_request - from ._request_builders_py3 import build_put_pet_request - from ._request_builders_py3 import build_get_feline_request - from ._request_builders_py3 import build_put_feline_request - from ._request_builders_py3 import build_get_cat_request - from ._request_builders_py3 import build_put_cat_request - from ._request_builders_py3 import build_get_kitten_request - from ._request_builders_py3 import build_put_kitten_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_horse_request # type: ignore - from ._request_builders import build_put_horse_request # type: ignore - from ._request_builders import build_get_pet_request # type: ignore - from ._request_builders import build_put_pet_request # type: ignore - from ._request_builders import build_get_feline_request # type: ignore - from ._request_builders import build_put_feline_request # type: ignore - from ._request_builders import build_get_cat_request # type: ignore - from ._request_builders import build_put_cat_request # type: ignore - from ._request_builders import build_get_kitten_request # type: ignore - from ._request_builders import build_put_kitten_request # type: ignore +from ._request_builders import build_get_horse_request +from ._request_builders import build_put_horse_request +from ._request_builders import build_get_pet_request +from ._request_builders import build_put_pet_request +from ._request_builders import build_get_feline_request +from ._request_builders import build_put_feline_request +from ._request_builders import build_get_cat_request +from ._request_builders import build_put_cat_request +from ._request_builders import build_get_kitten_request +from ._request_builders import build_put_kitten_request __all__ = [ "build_get_horse_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py index 8454e4dc543..065d7f88412 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_horse_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_horse_request(**kwargs: Any) -> HttpRequest: """Get a horse with name 'Fred' and isAShowHorse true. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -41,27 +37,19 @@ def build_get_horse_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/horse" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_horse_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_horse_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a horse with name 'General' and isAShowHorse false. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -89,10 +77,7 @@ def build_put_horse_request( @overload -def build_put_horse_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_horse_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a horse with name 'General' and isAShowHorse false. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -110,10 +95,7 @@ def build_put_horse_request( """ -def build_put_horse_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_horse_request(**kwargs: Any) -> HttpRequest: """Put a horse with name 'General' and isAShowHorse false. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -133,29 +115,21 @@ def build_put_horse_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/horse" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_pet_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_pet_request(**kwargs: Any) -> HttpRequest: """Get a pet with name 'Peanut'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -169,27 +143,19 @@ def build_get_pet_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/pet" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_pet_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_pet_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a pet with name 'Butter'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -216,10 +182,7 @@ def build_put_pet_request( @overload -def build_put_pet_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_pet_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a pet with name 'Butter'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -237,10 +200,7 @@ def build_put_pet_request( """ -def build_put_pet_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_pet_request(**kwargs: Any) -> HttpRequest: """Put a pet with name 'Butter'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -259,29 +219,21 @@ def build_put_pet_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/pet" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_feline_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_feline_request(**kwargs: Any) -> HttpRequest: """Get a feline where meows and hisses are true. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -295,27 +247,19 @@ def build_get_feline_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/feline" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_feline_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_feline_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a feline who hisses and doesn't meow. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -343,10 +287,7 @@ def build_put_feline_request( @overload -def build_put_feline_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_feline_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a feline who hisses and doesn't meow. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -364,10 +305,7 @@ def build_put_feline_request( """ -def build_put_feline_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_feline_request(**kwargs: Any) -> HttpRequest: """Put a feline who hisses and doesn't meow. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -387,29 +325,21 @@ def build_put_feline_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/feline" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_cat_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_cat_request(**kwargs: Any) -> HttpRequest: """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -423,27 +353,19 @@ def build_get_cat_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/cat" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_cat_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_cat_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -474,10 +396,7 @@ def build_put_cat_request( @overload -def build_put_cat_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_cat_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -496,10 +415,7 @@ def build_put_cat_request( """ -def build_put_cat_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_cat_request(**kwargs: Any) -> HttpRequest: """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -519,29 +435,21 @@ def build_put_cat_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/cat" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_get_kitten_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_kitten_request(**kwargs: Any) -> HttpRequest: """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet is false. @@ -556,27 +464,19 @@ def build_get_kitten_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/kitten" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) @overload -def build_put_kitten_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_kitten_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. @@ -609,10 +509,7 @@ def build_put_kitten_request( @overload -def build_put_kitten_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_kitten_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. @@ -632,10 +529,7 @@ def build_put_kitten_request( """ -def build_put_kitten_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_kitten_request(**kwargs: Any) -> HttpRequest: """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is true. @@ -656,20 +550,15 @@ def build_put_kitten_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/multipleInheritance/kitten" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 501d3fe1a6e..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/MultipleInheritanceLowLevel/multipleinheritancelowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,685 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_horse_request( - **kwargs: Any -) -> HttpRequest: - """Get a horse with name 'Fred' and isAShowHorse true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/horse" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_horse_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a horse with name 'General' and isAShowHorse false. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a horse with name 'General' and isAShowHorse false. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "isAShowHorse": bool, # Optional. - "name": "str" # Required. - } - """ - - -@overload -def build_put_horse_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a horse with name 'General' and isAShowHorse false. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Put a horse with name 'General' and isAShowHorse false. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_horse_request( - **kwargs: Any -) -> HttpRequest: - """Put a horse with name 'General' and isAShowHorse false. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a horse with name 'General' and isAShowHorse false. Is either a model type - or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/horse" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_pet_request( - **kwargs: Any -) -> HttpRequest: - """Get a pet with name 'Peanut'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/pet" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_pet_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a pet with name 'Butter'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a pet with name 'Butter'. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "name": "str" # Required. - } - """ - - -@overload -def build_put_pet_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a pet with name 'Butter'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Put a pet with name 'Butter'. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_pet_request( - **kwargs: Any -) -> HttpRequest: - """Put a pet with name 'Butter'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a pet with name 'Butter'. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/pet" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_feline_request( - **kwargs: Any -) -> HttpRequest: - """Get a feline where meows and hisses are true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/feline" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_feline_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a feline who hisses and doesn't meow. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a feline who hisses and doesn't meow. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "hisses": bool, # Optional. - "meows": bool # Optional. - } - """ - - -@overload -def build_put_feline_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a feline who hisses and doesn't meow. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Put a feline who hisses and doesn't meow. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_feline_request( - **kwargs: Any -) -> HttpRequest: - """Put a feline who hisses and doesn't meow. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a feline who hisses and doesn't meow. Is either a model type or a IO type. - Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/feline" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_cat_request( - **kwargs: Any -) -> HttpRequest: - """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/cat" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_cat_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "hisses": bool, # Optional. - "likesMilk": bool, # Optional. - "meows": bool, # Optional. - "name": "str" # Required. - } - """ - - -@overload -def build_put_cat_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is - true. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_cat_request( - **kwargs: Any -) -> HttpRequest: - """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. - Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/cat" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_kitten_request( - **kwargs: Any -) -> HttpRequest: - """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet - is false. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/kitten" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_put_kitten_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is - true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and - eatsMiceYet is true. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "eatsMiceYet": bool, # Optional. - "hisses": bool, # Optional. - "likesMilk": bool, # Optional. - "meows": bool, # Optional. - "name": "str" # Required. - } - """ - - -@overload -def build_put_kitten_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is - true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and - eatsMiceYet is true. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_put_kitten_request( - **kwargs: Any -) -> HttpRequest: - """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is - true. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and - eatsMiceYet is true. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/multipleInheritance/kitten" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_client.py index b4c0445f40e..52c40562b08 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/_client.py @@ -28,7 +28,6 @@ class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keywor """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = NonStringEnumsClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/__init__.py index caeb33f5416..6bac485f11b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put_request - from ._request_builders_py3 import build_get_request -except (SyntaxError, ImportError): - from ._request_builders import build_put_request # type: ignore - from ._request_builders import build_get_request # type: ignore +from ._request_builders import build_put_request +from ._request_builders import build_get_request __all__ = [ "build_put_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py index c0357e51445..5ac06879437 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_put_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_request(*, json: Optional[float] = None, **kwargs: Any) -> HttpRequest: """Put a float enum. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -37,29 +33,21 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/nonStringEnums/float/put" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_request(**kwargs: Any) -> HttpRequest: """Get a float enum. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -73,17 +61,12 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/nonStringEnums/float/get" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py deleted file mode 100644 index 564f3271612..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/float/_request_builders_py3.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_put_request( - *, - json: Optional[float] = None, - **kwargs: Any -) -> HttpRequest: - """Put a float enum. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Input float enum. Known values are: 200.4, 403.4, 405.3, 406.2, and 429.1. - Default value is None. - :paramtype json: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/nonStringEnums/float/put" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_request( - **kwargs: Any -) -> HttpRequest: - """Get a float enum. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/nonStringEnums/float/get" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/__init__.py index caeb33f5416..6bac485f11b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put_request - from ._request_builders_py3 import build_get_request -except (SyntaxError, ImportError): - from ._request_builders import build_put_request # type: ignore - from ._request_builders import build_get_request # type: ignore +from ._request_builders import build_put_request +from ._request_builders import build_get_request __all__ = [ "build_put_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py index e36b588da44..240b7ad223e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_put_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_request(*, json: Optional[int] = None, **kwargs: Any) -> HttpRequest: """Put an int enum. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -37,29 +33,21 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/nonStringEnums/int/put" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_request(**kwargs: Any) -> HttpRequest: """Get an int enum. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -73,17 +61,12 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/nonStringEnums/int/get" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py deleted file mode 100644 index ba80331e168..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/NonStringEnumsLowLevel/nonstringenumslowlevel/rest/int/_request_builders_py3.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_put_request( - *, - json: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - """Put an int enum. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Input int enum. Known values are: 200, 403, 405, 406, and 429. Default value is - None. - :paramtype json: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/nonStringEnums/int/put" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_get_request( - **kwargs: Any -) -> HttpRequest: - """Get an int enum. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/nonStringEnums/int/get" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_client.py index ae3c51c660d..c409a367eaa 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/_client.py @@ -28,7 +28,6 @@ class ObjectTypeClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = ObjectTypeClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/__init__.py index 355267c5498..5c0124f9ae3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_request - from ._request_builders_py3 import build_put_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_request # type: ignore - from ._request_builders import build_put_request # type: ignore +from ._request_builders import build_get_request +from ._request_builders import build_put_request __all__ = [ "build_get_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py index 972d2e38d26..39ae299f51b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_request(**kwargs: Any) -> HttpRequest: """Basic get that returns an object. Returns object { 'message': 'An object was successfully returned' }. @@ -42,26 +38,18 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/objectType/get" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_request(*, json: JSON, **kwargs: Any) -> HttpRequest: """Basic put that puts an object. Pass in {'foo': 'bar'} to get a 200 and anything else to get an object error. @@ -78,20 +66,15 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/objectType/put" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 7cf9432a062..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ObjectTypeLowLevel/objecttypelowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_request( - **kwargs: Any -) -> HttpRequest: - """Basic get that returns an object. Returns object { 'message': 'An object was successfully - returned' }. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/objectType/get" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_request( - *, - json: JSON, - **kwargs: Any -) -> HttpRequest: - """Basic put that puts an object. Pass in {'foo': 'bar'} to get a 200 and anything else to get an - object error. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Pass in {'foo': 'bar'} for a 200, anything else for an object error. Required. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/objectType/put" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_client.py index b71528fbddc..31d146fa54a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestParameterFlatteningConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/__init__.py index 0f9c14f9c76..f4e2dd695ad 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_update_request -except (SyntaxError, ImportError): - from ._request_builders import build_update_request # type: ignore +from ._request_builders import build_update_request __all__ = [ "build_update_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py index 8a7aa7d09bc..11eeacdb49b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders.py @@ -23,15 +23,11 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off @overload def build_update_request( - resource_group_name, # type: str - avset, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, avset: str, *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Updates the tags for an availability set. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -65,11 +61,8 @@ def build_update_request( @overload def build_update_request( - resource_group_name, # type: str - avset, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, avset: str, *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Updates the tags for an availability set. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -91,12 +84,7 @@ def build_update_request( """ -def build_update_request( - resource_group_name, # type: str - avset, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_update_request(resource_group_name: str, avset: str, **kwargs: Any) -> HttpRequest: """Updates the tags for an availability set. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -119,23 +107,18 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/parameterFlattening/{resourceGroupName}/{availabilitySetName}" path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "availabilitySetName": _SERIALIZER.url("avset", avset, 'str', max_length=80), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "availabilitySetName": _SERIALIZER.url("avset", avset, "str", max_length=80), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PATCH", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py deleted file mode 100644 index 31e3652c0c3..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterFlatteningLowLevel/parameterflatteninglowlevel/rest/availability_sets/_request_builders_py3.py +++ /dev/null @@ -1,144 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -@overload -def build_update_request( - resource_group_name: str, - avset: str, - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Updates the tags for an availability set. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param avset: The name of the storage availability set. Required. - :type avset: str - :keyword json: The tags. Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "tags": { - "str": "str" # A description about the set of tags. Required. - } - } - """ - - -@overload -def build_update_request( - resource_group_name: str, - avset: str, - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Updates the tags for an availability set. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param avset: The name of the storage availability set. Required. - :type avset: str - :keyword content: The tags. Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_update_request( - resource_group_name: str, - avset: str, - **kwargs: Any -) -> HttpRequest: - """Updates the tags for an availability set. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param avset: The name of the storage availability set. Required. - :type avset: str - :keyword json: The tags. Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/parameterFlattening/{resourceGroupName}/{availabilitySetName}" - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), - "availabilitySetName": _SERIALIZER.url("avset", avset, 'str', max_length=80), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/__init__.py index a2bcc31a29b..e17bdb605ab 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_request # type: ignore +from ._request_builders import build_get_request __all__ = [ "build_get_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders.py index 2843040ee3d..7100bd5f435 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders.py @@ -14,12 +14,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_request(**kwargs: Any) -> HttpRequest: """Basic get to make sure base url formatting of 'endpoint' works. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,8 +30,4 @@ def build_get_request( # Construct URL _url = "/parameterizedEndpoint/get" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 1ffa72cf209..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ParameterizedEndpointLowLevel/parameterizedendpointlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest - -from .._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_request( - **kwargs: Any -) -> HttpRequest: - """Basic get to make sure base url formatting of 'endpoint' works. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/parameterizedEndpoint/get" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_client.py index 75ef50d7127..3b55382f5ce 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestReportService: # pylint: disable=client-accepts-api-version-keywo """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestReportServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py index 7d62f26b1bd..5d705ae4de1 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/__init__.py @@ -6,12 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_report_request - from ._request_builders_py3 import build_get_optional_report_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_report_request # type: ignore - from ._request_builders import build_get_optional_report_request # type: ignore +from ._request_builders import build_get_report_request +from ._request_builders import build_get_optional_report_request __all__ = [ "build_get_report_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py index 25cbe09aa8c..21e944d8ae8 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_report_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get test coverage report. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -39,32 +35,22 @@ def build_get_report_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - qualifier = kwargs.pop('qualifier', _params.pop('qualifier', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/report" # Construct parameters if qualifier is not None: - _params['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') + _params["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_optional_report_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_optional_report_request(*, qualifier: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get optional test coverage report. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -83,23 +69,16 @@ def build_get_optional_report_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - qualifier = kwargs.pop('qualifier', _params.pop('qualifier', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/report/optional" # Construct parameters if qualifier is not None: - _params['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') + _params["qualifier"] = _SERIALIZER.query("qualifier", qualifier, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 7d26652b1f5..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReportLowLevel/reportlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,105 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_report_request( - *, - qualifier: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get test coverage report. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' - in for Python). The only effect is, that generators that run all tests several times, can - distinguish the generated reports. Default value is None. - :paramtype qualifier: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/report" - - # Construct parameters - if qualifier is not None: - _params['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_optional_report_request( - *, - qualifier: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get optional test coverage report. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword qualifier: If specified, qualifies the generated report further (e.g. '2.7' vs '3.5' - in for Python). The only effect is, that generators that run all tests several times, can - distinguish the generated reports. Default value is None. - :paramtype qualifier: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/report/optional" - - # Construct parameters - if qualifier is not None: - _params['qualifier'] = _SERIALIZER.query("qualifier", qualifier, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_client.py index 2fa590c7e92..d0f52654307 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/_client.py @@ -42,7 +42,6 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestRequiredOptionalTestServiceConfiguration( required_global_path=required_global_path, required_global_query=required_global_query, diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/__init__.py index 573a6e28340..505873cfc54 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/__init__.py @@ -6,56 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_put_optional_binary_body_request - from ._request_builders_py3 import build_put_required_binary_body_request - from ._request_builders_py3 import build_post_required_integer_parameter_request - from ._request_builders_py3 import build_post_optional_integer_parameter_request - from ._request_builders_py3 import build_post_required_integer_property_request - from ._request_builders_py3 import build_post_optional_integer_property_request - from ._request_builders_py3 import build_post_required_integer_header_request - from ._request_builders_py3 import build_post_optional_integer_header_request - from ._request_builders_py3 import build_post_required_string_parameter_request - from ._request_builders_py3 import build_post_optional_string_parameter_request - from ._request_builders_py3 import build_post_required_string_property_request - from ._request_builders_py3 import build_post_optional_string_property_request - from ._request_builders_py3 import build_post_required_string_header_request - from ._request_builders_py3 import build_post_optional_string_header_request - from ._request_builders_py3 import build_post_required_class_parameter_request - from ._request_builders_py3 import build_post_optional_class_parameter_request - from ._request_builders_py3 import build_post_required_class_property_request - from ._request_builders_py3 import build_post_optional_class_property_request - from ._request_builders_py3 import build_post_required_array_parameter_request - from ._request_builders_py3 import build_post_optional_array_parameter_request - from ._request_builders_py3 import build_post_required_array_property_request - from ._request_builders_py3 import build_post_optional_array_property_request - from ._request_builders_py3 import build_post_required_array_header_request - from ._request_builders_py3 import build_post_optional_array_header_request -except (SyntaxError, ImportError): - from ._request_builders import build_put_optional_binary_body_request # type: ignore - from ._request_builders import build_put_required_binary_body_request # type: ignore - from ._request_builders import build_post_required_integer_parameter_request # type: ignore - from ._request_builders import build_post_optional_integer_parameter_request # type: ignore - from ._request_builders import build_post_required_integer_property_request # type: ignore - from ._request_builders import build_post_optional_integer_property_request # type: ignore - from ._request_builders import build_post_required_integer_header_request # type: ignore - from ._request_builders import build_post_optional_integer_header_request # type: ignore - from ._request_builders import build_post_required_string_parameter_request # type: ignore - from ._request_builders import build_post_optional_string_parameter_request # type: ignore - from ._request_builders import build_post_required_string_property_request # type: ignore - from ._request_builders import build_post_optional_string_property_request # type: ignore - from ._request_builders import build_post_required_string_header_request # type: ignore - from ._request_builders import build_post_optional_string_header_request # type: ignore - from ._request_builders import build_post_required_class_parameter_request # type: ignore - from ._request_builders import build_post_optional_class_parameter_request # type: ignore - from ._request_builders import build_post_required_class_property_request # type: ignore - from ._request_builders import build_post_optional_class_property_request # type: ignore - from ._request_builders import build_post_required_array_parameter_request # type: ignore - from ._request_builders import build_post_optional_array_parameter_request # type: ignore - from ._request_builders import build_post_required_array_property_request # type: ignore - from ._request_builders import build_post_optional_array_property_request # type: ignore - from ._request_builders import build_post_required_array_header_request # type: ignore - from ._request_builders import build_post_optional_array_header_request # type: ignore +from ._request_builders import build_put_optional_binary_body_request +from ._request_builders import build_put_required_binary_body_request +from ._request_builders import build_post_required_integer_parameter_request +from ._request_builders import build_post_optional_integer_parameter_request +from ._request_builders import build_post_required_integer_property_request +from ._request_builders import build_post_optional_integer_property_request +from ._request_builders import build_post_required_integer_header_request +from ._request_builders import build_post_optional_integer_header_request +from ._request_builders import build_post_required_string_parameter_request +from ._request_builders import build_post_optional_string_parameter_request +from ._request_builders import build_post_required_string_property_request +from ._request_builders import build_post_optional_string_property_request +from ._request_builders import build_post_required_string_header_request +from ._request_builders import build_post_optional_string_header_request +from ._request_builders import build_post_required_class_parameter_request +from ._request_builders import build_post_optional_class_parameter_request +from ._request_builders import build_post_required_class_property_request +from ._request_builders import build_post_optional_class_property_request +from ._request_builders import build_post_required_array_parameter_request +from ._request_builders import build_post_optional_array_parameter_request +from ._request_builders import build_post_required_array_property_request +from ._request_builders import build_post_optional_array_property_request +from ._request_builders import build_post_required_array_header_request +from ._request_builders import build_post_optional_array_header_request __all__ = [ "build_put_optional_binary_body_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py index fa29c7d50d0..471d8f34db6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders.py @@ -22,12 +22,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_put_optional_binary_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_optional_binary_body_request(*, content: Optional[IO] = None, **kwargs: Any) -> HttpRequest: """Test explicitly optional body parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -43,29 +39,21 @@ def build_put_optional_binary_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/explicit/optional/binary-body" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_put_required_binary_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_required_binary_body_request(*, content: IO, **kwargs: Any) -> HttpRequest: """Test explicitly required body parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -81,29 +69,21 @@ def build_put_required_binary_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/explicit/required/binary-body" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_post_required_integer_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_integer_parameter_request(*, json: int, **kwargs: Any) -> HttpRequest: """Test explicitly required integer. Please put null and the client library should throw before the request is sent. @@ -120,29 +100,21 @@ def build_post_required_integer_parameter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/integer/parameter" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) -def build_post_optional_integer_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_integer_parameter_request(*, json: Optional[int] = None, **kwargs: Any) -> HttpRequest: """Test explicitly optional integer. Please put null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -158,30 +130,24 @@ def build_post_optional_integer_parameter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/integer/parameter" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, json=json, **kwargs) @overload def build_post_required_integer_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -210,9 +176,8 @@ def build_post_required_integer_property_request( @overload def build_post_required_integer_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -231,10 +196,7 @@ def build_post_required_integer_property_request( """ -def build_post_required_integer_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_integer_property_request(**kwargs: Any) -> HttpRequest: """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -254,30 +216,24 @@ def build_post_required_integer_property_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/integer/property" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_optional_integer_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -305,9 +261,8 @@ def build_post_optional_integer_property_request( @overload def build_post_optional_integer_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -325,10 +280,7 @@ def build_post_optional_integer_property_request( """ -def build_post_optional_integer_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_integer_property_request(**kwargs: Any) -> HttpRequest: """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -347,29 +299,21 @@ def build_post_optional_integer_property_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/integer/property" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_required_integer_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_integer_header_request(*, header_parameter: int, **kwargs: Any) -> HttpRequest: """Test explicitly required integer. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -386,28 +330,19 @@ def build_post_required_integer_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - header_parameter = kwargs.pop('header_parameter') # type: int - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/integer/header" # Construct headers - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "int") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_optional_integer_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_integer_header_request(*, header_parameter: Optional[int] = None, **kwargs: Any) -> HttpRequest: """Test explicitly optional integer. Please put a header 'headerParameter' => null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -423,29 +358,20 @@ def build_post_optional_integer_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - header_parameter = kwargs.pop('header_parameter', _headers.pop('headerParameter', None)) # type: Optional[int] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/integer/header" # Construct headers if header_parameter is not None: - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "int") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_required_string_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_string_parameter_request(*, content: str, **kwargs: Any) -> HttpRequest: """Test explicitly required string. Please put null and the client library should throw before the request is sent. @@ -462,29 +388,21 @@ def build_post_required_string_parameter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/string/parameter" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, content=content, **kwargs) -def build_post_optional_string_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_string_parameter_request(*, content: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Test explicitly optional string. Please put null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -500,30 +418,24 @@ def build_post_optional_string_parameter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/string/parameter" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, content=content, **kwargs) @overload def build_post_required_string_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -552,9 +464,8 @@ def build_post_required_string_property_request( @overload def build_post_required_string_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -573,10 +484,7 @@ def build_post_required_string_property_request( """ -def build_post_required_string_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_string_property_request(**kwargs: Any) -> HttpRequest: """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -596,30 +504,24 @@ def build_post_required_string_property_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/string/property" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_optional_string_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -647,9 +549,8 @@ def build_post_optional_string_property_request( @overload def build_post_optional_string_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -667,10 +568,7 @@ def build_post_optional_string_property_request( """ -def build_post_optional_string_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_string_property_request(**kwargs: Any) -> HttpRequest: """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -689,29 +587,21 @@ def build_post_optional_string_property_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/string/property" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_required_string_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_string_header_request(*, header_parameter: str, **kwargs: Any) -> HttpRequest: """Test explicitly required string. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -728,28 +618,19 @@ def build_post_required_string_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - header_parameter = kwargs.pop('header_parameter') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/string/header" # Construct headers - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_optional_string_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_string_header_request(*, body_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Test explicitly optional string. Please put a header 'headerParameter' => null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -765,30 +646,23 @@ def build_post_optional_string_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - body_parameter = kwargs.pop('body_parameter', _headers.pop('bodyParameter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/string/header" # Construct headers if body_parameter is not None: - _headers['bodyParameter'] = _SERIALIZER.header("body_parameter", body_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["bodyParameter"] = _SERIALIZER.header("body_parameter", body_parameter, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_required_class_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -818,9 +692,8 @@ def build_post_required_class_parameter_request( @overload def build_post_required_class_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -839,10 +712,7 @@ def build_post_required_class_parameter_request( """ -def build_post_required_class_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_class_parameter_request(**kwargs: Any) -> HttpRequest: """Test explicitly required complex object. Please put null and the client library should throw before the request is sent. @@ -862,30 +732,24 @@ def build_post_required_class_parameter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/class/parameter" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_optional_class_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional complex object. Please put null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -914,9 +778,8 @@ def build_post_optional_class_parameter_request( @overload def build_post_optional_class_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional complex object. Please put null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -934,10 +797,7 @@ def build_post_optional_class_parameter_request( """ -def build_post_optional_class_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_class_parameter_request(**kwargs: Any) -> HttpRequest: """Test explicitly optional complex object. Please put null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -956,30 +816,24 @@ def build_post_optional_class_parameter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/class/parameter" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_required_class_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1011,9 +865,8 @@ def build_post_required_class_property_request( @overload def build_post_required_class_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1032,10 +885,7 @@ def build_post_required_class_property_request( """ -def build_post_required_class_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_class_property_request(**kwargs: Any) -> HttpRequest: """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1055,30 +905,24 @@ def build_post_required_class_property_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/class/property" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_optional_class_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1109,9 +953,8 @@ def build_post_optional_class_property_request( @overload def build_post_optional_class_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1129,10 +972,7 @@ def build_post_optional_class_property_request( """ -def build_post_optional_class_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_class_property_request(**kwargs: Any) -> HttpRequest: """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1151,30 +991,24 @@ def build_post_optional_class_property_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/class/property" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_required_array_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: List[str], content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -1203,9 +1037,8 @@ def build_post_required_array_parameter_request( @overload def build_post_required_array_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -1224,10 +1057,7 @@ def build_post_required_array_parameter_request( """ -def build_post_required_array_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_array_parameter_request(**kwargs: Any) -> HttpRequest: """Test explicitly required array. Please put null and the client library should throw before the request is sent. @@ -1247,30 +1077,24 @@ def build_post_required_array_parameter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/array/parameter" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_optional_array_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[List[str]] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional array. Please put null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1298,9 +1122,8 @@ def build_post_optional_array_parameter_request( @overload def build_post_optional_array_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional array. Please put null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1318,10 +1141,7 @@ def build_post_optional_array_parameter_request( """ -def build_post_optional_array_parameter_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_array_parameter_request(**kwargs: Any) -> HttpRequest: """Test explicitly optional array. Please put null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1340,30 +1160,24 @@ def build_post_optional_array_parameter_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/array/parameter" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_required_array_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, json: JSON, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1394,9 +1208,8 @@ def build_post_required_array_property_request( @overload def build_post_required_array_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content: IO, content_type: Optional[str] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1415,10 +1228,7 @@ def build_post_required_array_property_request( """ -def build_post_required_array_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_array_property_request(**kwargs: Any) -> HttpRequest: """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the client library should throw before the request is sent. @@ -1438,30 +1248,24 @@ def build_post_required_array_property_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/array/property" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) @overload def build_post_optional_array_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1491,9 +1295,8 @@ def build_post_optional_array_property_request( @overload def build_post_optional_array_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1511,10 +1314,7 @@ def build_post_optional_array_property_request( """ -def build_post_optional_array_property_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_optional_array_property_request(**kwargs: Any) -> HttpRequest: """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1533,29 +1333,21 @@ def build_post_optional_array_property_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/array/property" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_post_required_array_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_required_array_header_request(*, header_parameter: List[str], **kwargs: Any) -> HttpRequest: """Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is sent. @@ -1572,28 +1364,21 @@ def build_post_required_array_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - header_parameter = kwargs.pop('header_parameter') # type: List[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/requied/array/header" # Construct headers - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, '[str]', div=',') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "[str]", div=",") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) def build_post_optional_array_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, header_parameter: Optional[List[str]] = None, **kwargs: Any +) -> HttpRequest: """Test explicitly optional integer. Please put a header 'headerParameter' => null. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1609,20 +1394,14 @@ def build_post_optional_array_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - header_parameter = kwargs.pop('header_parameter', _headers.pop('headerParameter', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/optional/array/header" # Construct headers if header_parameter is not None: - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, '[str]', div=',') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["headerParameter"] = _SERIALIZER.header("header_parameter", header_parameter, "[str]", div=",") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py deleted file mode 100644 index a025e2b404d..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/explicit/_request_builders_py3.py +++ /dev/null @@ -1,1676 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, List, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_put_optional_binary_body_request( - *, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional body parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/explicit/optional/binary-body" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_put_required_binary_body_request( - *, - content: IO, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required body parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/explicit/required/binary-body" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_post_required_integer_parameter_request( - *, - json: int, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required integer. Please put null and the client library should throw before - the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/integer/parameter" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_post_optional_integer_parameter_request( - *, - json: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Default value is None. - :paramtype json: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/integer/parameter" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -@overload -def build_post_required_integer_property_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "value": 0 # Required. - } - """ - - -@overload -def build_post_required_integer_property_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_required_integer_property_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly required integer. Please put a valid int-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/integer/property" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_optional_integer_property_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "value": 0 # Optional. - } - """ - - -@overload -def build_post_optional_integer_property_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_optional_integer_property_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put a valid int-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/integer/property" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_required_integer_header_request( - *, - header_parameter: int, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required integer. Please put a header 'headerParameter' => null and the client - library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword header_parameter: Required. - :paramtype header_parameter: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/integer/header" - - # Construct headers - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_optional_integer_header_request( - *, - header_parameter: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put a header 'headerParameter' => null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword header_parameter: Default value is None. - :paramtype header_parameter: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/integer/header" - - # Construct headers - if header_parameter is not None: - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'int') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_required_string_parameter_request( - *, - content: str, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required string. Please put null and the client library should throw before the - request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/string/parameter" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_post_optional_string_parameter_request( - *, - content: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional string. Please put null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Default value is None. - :paramtype content: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/string/parameter" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -@overload -def build_post_required_string_property_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "value": "str" # Required. - } - """ - - -@overload -def build_post_required_string_property_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_required_string_property_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly required string. Please put a valid string-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/string/property" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_optional_string_property_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "value": "str" # Optional. - } - """ - - -@overload -def build_post_optional_string_property_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_optional_string_property_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put a valid string-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/string/property" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_required_string_header_request( - *, - header_parameter: str, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required string. Please put a header 'headerParameter' => null and the client - library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword header_parameter: Required. - :paramtype header_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/string/header" - - # Construct headers - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_optional_string_header_request( - *, - body_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional string. Please put a header 'headerParameter' => null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword body_parameter: Default value is None. - :paramtype body_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/string/header" - - # Construct headers - if body_parameter is not None: - _headers['bodyParameter'] = _SERIALIZER.header("body_parameter", body_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_required_class_parameter_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required complex object. Please put null and the client library should throw - before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": 0, # Required. - "name": "str" # Optional. - } - """ - - -@overload -def build_post_required_class_parameter_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required complex object. Please put null and the client library should throw - before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_required_class_parameter_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly required complex object. Please put null and the client library should throw - before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/class/parameter" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_optional_class_parameter_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional complex object. Please put null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": 0, # Required. - "name": "str" # Optional. - } - """ - - -@overload -def build_post_optional_class_parameter_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional complex object. Please put null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_optional_class_parameter_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional complex object. Please put null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/class/parameter" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_required_class_property_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null - and the client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "value": { - "id": 0, # Required. - "name": "str" # Optional. Required. - } - } - """ - - -@overload -def build_post_required_class_property_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null - and the client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_required_class_property_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly required complex object. Please put a valid class-wrapper with 'value' = null - and the client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/class/property" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_optional_class_property_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "value": { - "id": 0, # Required. - "name": "str" # Optional. - } - } - """ - - -@overload -def build_post_optional_class_property_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_optional_class_property_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional complex object. Please put a valid class-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/class/property" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_required_array_parameter_request( - *, - json: List[str], - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required array. Please put null and the client library should throw before the - request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "str" # Optional. - ] - """ - - -@overload -def build_post_required_array_parameter_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required array. Please put null and the client library should throw before the - request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_required_array_parameter_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly required array. Please put null and the client library should throw before the - request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a list type or a IO type. Required. - :paramtype json: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/array/parameter" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_optional_array_parameter_request( - *, - content_type: Optional[str] = None, - json: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional array. Please put null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Default value is None. - :paramtype json: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = [ - "str" # Optional. - ] - """ - - -@overload -def build_post_optional_array_parameter_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional array. Please put null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_optional_array_parameter_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional array. Please put null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Is either a list type or a IO type. Default value is None. - :paramtype json: list[str] or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/array/parameter" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_required_array_property_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "value": [ - "str" # Required. - ] - } - """ - - -@overload -def build_post_required_array_property_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_required_array_property_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly required array. Please put a valid array-wrapper with 'value' = null and the - client library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/array/property" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -@overload -def build_post_optional_array_property_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "value": [ - "str" # Optional. - ] - } - """ - - -@overload -def build_post_optional_array_property_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_optional_array_property_request( - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional array. Please put a valid array-wrapper with 'value' = null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/array/property" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_required_array_header_request( - *, - header_parameter: List[str], - **kwargs: Any -) -> HttpRequest: - """Test explicitly required array. Please put a header 'headerParameter' => null and the client - library should throw before the request is sent. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword header_parameter: Required. - :paramtype header_parameter: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/requied/array/header" - - # Construct headers - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, '[str]', div=',') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_post_optional_array_header_request( - *, - header_parameter: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Test explicitly optional integer. Please put a header 'headerParameter' => null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword header_parameter: Default value is None. - :paramtype header_parameter: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/optional/array/header" - - # Construct headers - if header_parameter is not None: - _headers['headerParameter'] = _SERIALIZER.header("header_parameter", header_parameter, '[str]', div=',') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/__init__.py index 7963f152b24..54b9c8be42e 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/__init__.py @@ -6,24 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_required_path_request - from ._request_builders_py3 import build_put_optional_query_request - from ._request_builders_py3 import build_put_optional_header_request - from ._request_builders_py3 import build_put_optional_body_request - from ._request_builders_py3 import build_put_optional_binary_body_request - from ._request_builders_py3 import build_get_required_global_path_request - from ._request_builders_py3 import build_get_required_global_query_request - from ._request_builders_py3 import build_get_optional_global_query_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_required_path_request # type: ignore - from ._request_builders import build_put_optional_query_request # type: ignore - from ._request_builders import build_put_optional_header_request # type: ignore - from ._request_builders import build_put_optional_body_request # type: ignore - from ._request_builders import build_put_optional_binary_body_request # type: ignore - from ._request_builders import build_get_required_global_path_request # type: ignore - from ._request_builders import build_get_required_global_query_request # type: ignore - from ._request_builders import build_get_optional_global_query_request # type: ignore +from ._request_builders import build_get_required_path_request +from ._request_builders import build_put_optional_query_request +from ._request_builders import build_put_optional_header_request +from ._request_builders import build_put_optional_body_request +from ._request_builders import build_put_optional_binary_body_request +from ._request_builders import build_get_required_global_path_request +from ._request_builders import build_get_required_global_query_request +from ._request_builders import build_get_optional_global_query_request __all__ = [ "build_get_required_path_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py index 114e733060a..6c4ba1f8528 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders.py @@ -16,13 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_required_path_request( - path_parameter, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_required_path_request(path_parameter: str, **kwargs: Any) -> HttpRequest: """Test implicitly required path parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -38,31 +33,23 @@ def build_get_required_path_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/implicit/required/path/{pathParameter}" path_format_arguments = { - "pathParameter": _SERIALIZER.url("path_parameter", path_parameter, 'str'), + "pathParameter": _SERIALIZER.url("path_parameter", path_parameter, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_optional_query_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_optional_query_request(*, query_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Test implicitly optional query parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -79,32 +66,22 @@ def build_put_optional_query_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - query_parameter = kwargs.pop('query_parameter', _params.pop('queryParameter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/implicit/optional/query" # Construct parameters if query_parameter is not None: - _params['queryParameter'] = _SERIALIZER.query("query_parameter", query_parameter, 'str') + _params["queryParameter"] = _SERIALIZER.query("query_parameter", query_parameter, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_put_optional_header_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_optional_header_request(*, query_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Test implicitly optional header parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -120,29 +97,20 @@ def build_put_optional_header_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - query_parameter = kwargs.pop('query_parameter', _headers.pop('queryParameter', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/implicit/optional/header" # Construct headers if query_parameter is not None: - _headers['queryParameter'] = _SERIALIZER.header("query_parameter", query_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["queryParameter"] = _SERIALIZER.header("query_parameter", query_parameter, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_put_optional_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_optional_body_request(*, content: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Test implicitly optional body parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -158,29 +126,21 @@ def build_put_optional_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/implicit/optional/body" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_put_optional_binary_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_optional_binary_body_request(*, content: Optional[IO] = None, **kwargs: Any) -> HttpRequest: """Test implicitly optional body parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -196,30 +156,21 @@ def build_put_optional_binary_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/implicit/optional/binary-body" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_required_global_path_request( - required_global_path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) + + +def build_get_required_global_path_request(required_global_path: str, **kwargs: Any) -> HttpRequest: """Test implicitly required path parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -235,31 +186,23 @@ def build_get_required_global_path_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/global/required/path/{required-global-path}" path_format_arguments = { - "required-global-path": _SERIALIZER.url("required_global_path", required_global_path, 'str'), + "required-global-path": _SERIALIZER.url("required_global_path", required_global_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_required_global_query_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_required_global_query_request(*, required_global_query: str, **kwargs: Any) -> HttpRequest: """Test implicitly required query parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -276,31 +219,23 @@ def build_get_required_global_query_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - required_global_query = kwargs.pop('required_global_query') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/global/required/query" # Construct parameters - _params['required-global-query'] = _SERIALIZER.query("required_global_query", required_global_query, 'str') + _params["required-global-query"] = _SERIALIZER.query("required_global_query", required_global_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_optional_global_query_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, optional_global_query: Optional[int] = None, **kwargs: Any +) -> HttpRequest: """Test implicitly optional query parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -317,23 +252,16 @@ def build_get_optional_global_query_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - optional_global_query = kwargs.pop('optional_global_query', _params.pop('optional-global-query', None)) # type: Optional[int] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reqopt/global/optional/query" # Construct parameters if optional_global_query is not None: - _params['optional-global-query'] = _SERIALIZER.query("optional_global_query", optional_global_query, 'int') + _params["optional-global-query"] = _SERIALIZER.query("optional_global_query", optional_global_query, "int") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py deleted file mode 100644 index 2de106ad716..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/RequiredOptionalLowLevel/requiredoptionallowlevel/rest/implicit/_request_builders_py3.py +++ /dev/null @@ -1,341 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, IO, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_required_path_request( - path_parameter: str, - **kwargs: Any -) -> HttpRequest: - """Test implicitly required path parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param path_parameter: Required. - :type path_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/implicit/required/path/{pathParameter}" - path_format_arguments = { - "pathParameter": _SERIALIZER.url("path_parameter", path_parameter, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_optional_query_request( - *, - query_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test implicitly optional query parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword query_parameter: Default value is None. - :paramtype query_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/implicit/optional/query" - - # Construct parameters - if query_parameter is not None: - _params['queryParameter'] = _SERIALIZER.query("query_parameter", query_parameter, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_put_optional_header_request( - *, - query_parameter: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test implicitly optional header parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword query_parameter: Default value is None. - :paramtype query_parameter: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/implicit/optional/header" - - # Construct headers - if query_parameter is not None: - _headers['queryParameter'] = _SERIALIZER.header("query_parameter", query_parameter, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_optional_body_request( - *, - content: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Test implicitly optional body parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Default value is None. - :paramtype content: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/implicit/optional/body" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_put_optional_binary_body_request( - *, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Test implicitly optional body parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/implicit/optional/binary-body" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_required_global_path_request( - required_global_path: str, - **kwargs: Any -) -> HttpRequest: - """Test implicitly required path parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param required_global_path: number of items to skip. Required. - :type required_global_path: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/global/required/path/{required-global-path}" - path_format_arguments = { - "required-global-path": _SERIALIZER.url("required_global_path", required_global_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_required_global_query_request( - *, - required_global_query: str, - **kwargs: Any -) -> HttpRequest: - """Test implicitly required query parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword required_global_query: number of items to skip. Required. - :paramtype required_global_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/global/required/query" - - # Construct parameters - _params['required-global-query'] = _SERIALIZER.query("required_global_query", required_global_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_optional_global_query_request( - *, - optional_global_query: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - """Test implicitly optional query parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword optional_global_query: number of items to skip. Default value is None. - :paramtype optional_global_query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reqopt/global/optional/query" - - # Construct parameters - if optional_global_query is not None: - _params['optional-global-query'] = _SERIALIZER.query("optional_global_query", optional_global_query, 'int') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_client.py index fd67f70e123..0f37d46d273 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/_client.py @@ -28,7 +28,6 @@ class ReservedWordsClient: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = ReservedWordsClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/__init__.py index 0324ebe368c..778adf8941b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/__init__.py @@ -6,18 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_operation_with_content_param_request - from ._request_builders_py3 import build_operation_with_json_param_request - from ._request_builders_py3 import build_operation_with_data_param_request - from ._request_builders_py3 import build_operation_with_files_param_request - from ._request_builders_py3 import build_operation_with_url_request -except (SyntaxError, ImportError): - from ._request_builders import build_operation_with_content_param_request # type: ignore - from ._request_builders import build_operation_with_json_param_request # type: ignore - from ._request_builders import build_operation_with_data_param_request # type: ignore - from ._request_builders import build_operation_with_files_param_request # type: ignore - from ._request_builders import build_operation_with_url_request # type: ignore +from ._request_builders import build_operation_with_content_param_request +from ._request_builders import build_operation_with_json_param_request +from ._request_builders import build_operation_with_data_param_request +from ._request_builders import build_operation_with_files_param_request +from ._request_builders import build_operation_with_url_request __all__ = [ "build_operation_with_content_param_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders.py index ebf2f5588a5..8fcc00d675f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_operation_with_content_param_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_operation_with_content_param_request(*, content: IO, **kwargs: Any) -> HttpRequest: """Operation with body param called content. Pass in b'hello, world'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -37,29 +33,21 @@ def build_operation_with_content_param_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reservedWords/operation/content" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_operation_with_json_param_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_operation_with_json_param_request(*, json: Any, **kwargs: Any) -> HttpRequest: """Operation with body param called 'json'. Pass in {'hello': 'world'}. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -75,29 +63,21 @@ def build_operation_with_json_param_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reservedWords/operation/json" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, json=json, **kwargs) -def build_operation_with_data_param_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_operation_with_data_param_request(**kwargs: Any) -> HttpRequest: """Operation with urlencoded body param called 'data'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -119,29 +99,21 @@ def build_operation_with_data_param_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reservedWords/operation/data" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_operation_with_files_param_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_operation_with_files_param_request(**kwargs: Any) -> HttpRequest: """Operation with multipart body param called 'files'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -163,30 +135,23 @@ def build_operation_with_files_param_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reservedWords/operation/files" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) def build_operation_with_url_request( - url, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + url: str, *, header_parameters: str, query_parameters: Optional[List[str]] = None, **kwargs: Any +) -> HttpRequest: """Operation with path format argument URL, header param headerParameters, and query param queryParameters. @@ -210,30 +175,24 @@ def build_operation_with_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - header_parameters = kwargs.pop('header_parameters') # type: str - query_parameters = kwargs.pop('query_parameters', _params.pop('queryParameters', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reservedWords/{url}" path_format_arguments = { - "url": _SERIALIZER.url("url", url, 'str'), + "url": _SERIALIZER.url("url", url, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if query_parameters is not None: - _params['queryParameters'] = [_SERIALIZER.query("query_parameters", q, 'str') if q is not None else '' for q in query_parameters] + _params["queryParameters"] = [ + _SERIALIZER.query("query_parameters", q, "str") if q is not None else "" for q in query_parameters + ] # Construct headers - _headers['headerParameters'] = _SERIALIZER.header("header_parameters", header_parameters, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["headerParameters"] = _SERIALIZER.header("header_parameters", header_parameters, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 67152e4ee54..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,241 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, IO, List, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer -from .._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_operation_with_content_param_request( - *, - content: IO, - **kwargs: Any -) -> HttpRequest: - """Operation with body param called content. Pass in b'hello, world'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Pass in b'hello, world'. Required. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reservedWords/operation/content" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_operation_with_json_param_request( - *, - json: Any, - **kwargs: Any -) -> HttpRequest: - """Operation with body param called 'json'. Pass in {'hello': 'world'}. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Pass in {'hello': 'world'}. Required. - :paramtype json: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reservedWords/operation/json" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - json=json, - **kwargs - ) - - -def build_operation_with_data_param_request( - **kwargs: Any -) -> HttpRequest: - """Operation with urlencoded body param called 'data'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - data = { - "str": {} # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reservedWords/operation/data" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_operation_with_files_param_request( - **kwargs: Any -) -> HttpRequest: - """Operation with multipart body param called 'files'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - files = { - "str": {} # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reservedWords/operation/files" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_operation_with_url_request( - url: str, - *, - header_parameters: str, - query_parameters: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Operation with path format argument URL, header param headerParameters, and query param - queryParameters. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param url: Pass in 'foo'. Required. - :type url: str - :keyword header_parameters: Header arg that uses same name as headerParameters in generated - code. Pass in 'x-ms-header' to pass. Required. - :paramtype header_parameters: str - :keyword query_parameters: Query args that uses same name as queryParameters in generated code. - Pass in ['one', 'two'] to pass test. Default value is None. - :paramtype query_parameters: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reservedWords/{url}" - path_format_arguments = { - "url": _SERIALIZER.url("url", url, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - if query_parameters is not None: - _params['queryParameters'] = [_SERIALIZER.query("query_parameters", q, 'str') if q is not None else '' for q in query_parameters] - - # Construct headers - _headers['headerParameters'] = _SERIALIZER.header("header_parameters", header_parameters, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/__init__.py index 670686a56ad..9faef03b506 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_operation_one_request -except (SyntaxError, ImportError): - from ._request_builders import build_operation_one_request # type: ignore +from ._request_builders import build_operation_one_request __all__ = [ "build_operation_one_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/_request_builders.py index 4474fc2b39f..06be630c185 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_operation_one_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_operation_one_request(*, parameter1: str, **kwargs: Any) -> HttpRequest: """Operation in operation group import, a reserved word. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -37,22 +33,15 @@ def build_operation_one_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - parameter1 = kwargs.pop('parameter1') # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/reservedWords/operationGroup/import" # Construct parameters - _params['parameter1'] = _SERIALIZER.query("parameter1", parameter1, 'str') + _params["parameter1"] = _SERIALIZER.query("parameter1", parameter1, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/_request_builders_py3.py deleted file mode 100644 index f457fbe7378..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ReservedWordsLowLevel/reservedwordslowlevel/rest/import_operations/_request_builders_py3.py +++ /dev/null @@ -1,58 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_operation_one_request( - *, - parameter1: str, - **kwargs: Any -) -> HttpRequest: - """Operation in operation group import, a reserved word. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword parameter1: Pass in 'foo' to pass this test. Required. - :paramtype parameter1: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/reservedWords/operationGroup/import" - - # Construct parameters - _params['parameter1'] = _SERIALIZER.query("parameter1", parameter1, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/_client.py index 269f1587697..d1f30d84bf6 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/_client.py @@ -34,7 +34,6 @@ class AutorestSecurityAad: # pylint: disable=client-accepts-api-version-keyword def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutorestSecurityAadConfiguration(credential=credential, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/__init__.py index f5b9cb87e04..c348ad5916d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head_request -except (SyntaxError, ImportError): - from ._request_builders import build_head_request # type: ignore +from ._request_builders import build_head_request __all__ = [ "build_head_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/_request_builders.py index ff95e721f58..b76dcc7f032 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/_request_builders.py @@ -14,12 +14,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head_request(**kwargs: Any) -> HttpRequest: """Operation. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,8 +30,4 @@ def build_head_request( # Construct URL _url = "/securityaad" - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 135c53c8426..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityAadSwaggerLowLevel/securityaadswaggerlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest - -from .._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head_request( - **kwargs: Any -) -> HttpRequest: - """Operation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/securityaad" - - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/_client.py index c55f9b37190..eb0225cad83 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/_client.py @@ -33,7 +33,6 @@ class AutorestSecurityKey: # pylint: disable=client-accepts-api-version-keyword def __init__( self, credential: AzureKeyCredential, *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutorestSecurityKeyConfiguration(credential=credential, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/__init__.py index f5b9cb87e04..c348ad5916d 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/__init__.py @@ -6,10 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_head_request -except (SyntaxError, ImportError): - from ._request_builders import build_head_request # type: ignore +from ._request_builders import build_head_request __all__ = [ "build_head_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/_request_builders.py index a00ef94665a..bde3243d61c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/_request_builders.py @@ -14,12 +14,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_head_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_head_request(**kwargs: Any) -> HttpRequest: """Operation. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -34,8 +30,4 @@ def build_head_request( # Construct URL _url = "/securitykey" - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) + return HttpRequest(method="HEAD", url=_url, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index 5cda9f17b39..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/SecurityKeySwaggerLowLevel/securitykeyswaggerlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest - -from .._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_head_request( - **kwargs: Any -) -> HttpRequest: - """Operation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/securitykey" - - return HttpRequest( - method="HEAD", - url=_url, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_client.py index 4fb19f94243..311c73da8e2 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/_client.py @@ -40,7 +40,6 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestUrlTestServiceConfiguration( global_string_path=global_string_path, global_string_query=global_string_query, **kwargs ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/__init__.py index cd604938f2c..9f90e443bea 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_all_with_values_request - from ._request_builders_py3 import build_get_global_query_null_request - from ._request_builders_py3 import build_get_global_and_local_query_null_request - from ._request_builders_py3 import build_get_local_path_item_query_null_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_all_with_values_request # type: ignore - from ._request_builders import build_get_global_query_null_request # type: ignore - from ._request_builders import build_get_global_and_local_query_null_request # type: ignore - from ._request_builders import build_get_local_path_item_query_null_request # type: ignore +from ._request_builders import build_get_all_with_values_request +from ._request_builders import build_get_global_query_null_request +from ._request_builders import build_get_global_and_local_query_null_request +from ._request_builders import build_get_local_path_item_query_null_request __all__ = [ "build_get_all_with_values_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders.py index 36c96c5f70e..57d916c5913 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders.py @@ -16,15 +16,17 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_get_all_with_values_request( - path_item_string_path, # type: str - local_string_path, # type: str - global_string_path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + path_item_string_path: str, + local_string_path: str, + global_string_path: str, + *, + path_item_string_query: Optional[str] = None, + local_string_query: Optional[str] = None, + global_string_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery'. @@ -56,48 +58,42 @@ def build_get_all_with_values_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - path_item_string_query = kwargs.pop('path_item_string_query', _params.pop('pathItemStringQuery', None)) # type: Optional[str] - local_string_query = kwargs.pop('local_string_query', _params.pop('localStringQuery', None)) # type: Optional[str] - global_string_query = kwargs.pop('global_string_query', _params.pop('globalStringQuery', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery" # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if path_item_string_query is not None: - _params['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') + _params["pathItemStringQuery"] = _SERIALIZER.query("path_item_string_query", path_item_string_query, "str") if global_string_query is not None: - _params['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') + _params["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") if local_string_query is not None: - _params['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') + _params["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_global_query_null_request( - path_item_string_path, # type: str - local_string_path, # type: str - global_string_path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + path_item_string_path: str, + local_string_path: str, + global_string_path: str, + *, + path_item_string_query: Optional[str] = None, + local_string_query: Optional[str] = None, + global_string_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery'. @@ -129,48 +125,42 @@ def build_get_global_query_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - path_item_string_query = kwargs.pop('path_item_string_query', _params.pop('pathItemStringQuery', None)) # type: Optional[str] - local_string_query = kwargs.pop('local_string_query', _params.pop('localStringQuery', None)) # type: Optional[str] - global_string_query = kwargs.pop('global_string_query', _params.pop('globalStringQuery', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery" # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if path_item_string_query is not None: - _params['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') + _params["pathItemStringQuery"] = _SERIALIZER.query("path_item_string_query", path_item_string_query, "str") if global_string_query is not None: - _params['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') + _params["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") if local_string_query is not None: - _params['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') + _params["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_global_and_local_query_null_request( - path_item_string_path, # type: str - local_string_path, # type: str - global_string_path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + path_item_string_path: str, + local_string_path: str, + global_string_path: str, + *, + path_item_string_query: Optional[str] = None, + local_string_query: Optional[str] = None, + global_string_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery=null, pathItemStringQuery='pathItemStringQuery', localStringQuery=null. @@ -202,48 +192,42 @@ def build_get_global_and_local_query_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - path_item_string_query = kwargs.pop('path_item_string_query', _params.pop('pathItemStringQuery', None)) # type: Optional[str] - local_string_query = kwargs.pop('local_string_query', _params.pop('localStringQuery', None)) # type: Optional[str] - global_string_query = kwargs.pop('global_string_query', _params.pop('globalStringQuery', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null" # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if path_item_string_query is not None: - _params['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') + _params["pathItemStringQuery"] = _SERIALIZER.query("path_item_string_query", path_item_string_query, "str") if global_string_query is not None: - _params['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') + _params["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") if local_string_query is not None: - _params['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') + _params["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_local_path_item_query_null_request( - path_item_string_path, # type: str - local_string_path, # type: str - global_string_path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + path_item_string_path: str, + local_string_path: str, + global_string_path: str, + *, + path_item_string_query: Optional[str] = None, + local_string_query: Optional[str] = None, + global_string_query: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: """send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', localStringPath='localStringPath', globalStringQuery='globalStringQuery', pathItemStringQuery=null, localStringQuery=null. @@ -274,36 +258,27 @@ def build_get_local_path_item_query_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - path_item_string_query = kwargs.pop('path_item_string_query', _params.pop('pathItemStringQuery', None)) # type: Optional[str] - local_string_query = kwargs.pop('local_string_query', _params.pop('localStringQuery', None)) # type: Optional[str] - global_string_query = kwargs.pop('global_string_query', _params.pop('globalStringQuery', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null" # pylint: disable=line-too-long path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), + "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, "str"), + "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, "str"), + "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters if path_item_string_query is not None: - _params['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') + _params["pathItemStringQuery"] = _SERIALIZER.query("path_item_string_query", path_item_string_query, "str") if global_string_query is not None: - _params['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') + _params["globalStringQuery"] = _SERIALIZER.query("global_string_query", global_string_query, "str") if local_string_query is not None: - _params['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') + _params["localStringQuery"] = _SERIALIZER.query("local_string_query", local_string_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders_py3.py deleted file mode 100644 index b8f1f34f06f..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/path_items/_request_builders_py3.py +++ /dev/null @@ -1,309 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_all_with_values_request( - path_item_string_path: str, - local_string_path: str, - global_string_path: str, - *, - path_item_string_query: Optional[str] = None, - local_string_query: Optional[str] = None, - global_string_query: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', - localStringPath='localStringPath', globalStringQuery='globalStringQuery', - pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param path_item_string_path: A string value 'pathItemStringPath' that appears in the path. - Required. - :type path_item_string_path: str - :param local_string_path: should contain value 'localStringPath'. Required. - :type local_string_path: str - :param global_string_path: A string value 'globalItemStringPath' that appears in the path. - Required. - :type global_string_path: str - :keyword path_item_string_query: A string value 'pathItemStringQuery' that appears as a query - parameter. Default value is None. - :paramtype path_item_string_query: str - :keyword local_string_query: should contain value 'localStringQuery'. Default value is None. - :paramtype local_string_query: str - :keyword global_string_query: should contain value null. Default value is None. - :paramtype global_string_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/pathItemStringQuery/localStringQuery" # pylint: disable=line-too-long - path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - if path_item_string_query is not None: - _params['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') - if global_string_query is not None: - _params['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') - if local_string_query is not None: - _params['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_global_query_null_request( - path_item_string_path: str, - local_string_path: str, - global_string_path: str, - *, - path_item_string_query: Optional[str] = None, - local_string_query: Optional[str] = None, - global_string_query: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', - localStringPath='localStringPath', globalStringQuery=null, - pathItemStringQuery='pathItemStringQuery', localStringQuery='localStringQuery'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param path_item_string_path: A string value 'pathItemStringPath' that appears in the path. - Required. - :type path_item_string_path: str - :param local_string_path: should contain value 'localStringPath'. Required. - :type local_string_path: str - :param global_string_path: A string value 'globalItemStringPath' that appears in the path. - Required. - :type global_string_path: str - :keyword path_item_string_query: A string value 'pathItemStringQuery' that appears as a query - parameter. Default value is None. - :paramtype path_item_string_query: str - :keyword local_string_query: should contain value 'localStringQuery'. Default value is None. - :paramtype local_string_query: str - :keyword global_string_query: should contain value null. Default value is None. - :paramtype global_string_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/localStringQuery" # pylint: disable=line-too-long - path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - if path_item_string_query is not None: - _params['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') - if global_string_query is not None: - _params['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') - if local_string_query is not None: - _params['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_global_and_local_query_null_request( - path_item_string_path: str, - local_string_path: str, - global_string_path: str, - *, - path_item_string_query: Optional[str] = None, - local_string_query: Optional[str] = None, - global_string_query: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """send globalStringPath=globalStringPath, pathItemStringPath='pathItemStringPath', - localStringPath='localStringPath', globalStringQuery=null, - pathItemStringQuery='pathItemStringQuery', localStringQuery=null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param path_item_string_path: A string value 'pathItemStringPath' that appears in the path. - Required. - :type path_item_string_path: str - :param local_string_path: should contain value 'localStringPath'. Required. - :type local_string_path: str - :param global_string_path: A string value 'globalItemStringPath' that appears in the path. - Required. - :type global_string_path: str - :keyword path_item_string_query: A string value 'pathItemStringQuery' that appears as a query - parameter. Default value is None. - :paramtype path_item_string_query: str - :keyword local_string_query: should contain null value. Default value is None. - :paramtype local_string_query: str - :keyword global_string_query: should contain value null. Default value is None. - :paramtype global_string_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/null/pathItemStringQuery/null" # pylint: disable=line-too-long - path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - if path_item_string_query is not None: - _params['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') - if global_string_query is not None: - _params['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') - if local_string_query is not None: - _params['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_local_path_item_query_null_request( - path_item_string_path: str, - local_string_path: str, - global_string_path: str, - *, - path_item_string_query: Optional[str] = None, - local_string_query: Optional[str] = None, - global_string_query: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """send globalStringPath='globalStringPath', pathItemStringPath='pathItemStringPath', - localStringPath='localStringPath', globalStringQuery='globalStringQuery', - pathItemStringQuery=null, localStringQuery=null. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param path_item_string_path: A string value 'pathItemStringPath' that appears in the path. - Required. - :type path_item_string_path: str - :param local_string_path: should contain value 'localStringPath'. Required. - :type local_string_path: str - :param global_string_path: A string value 'globalItemStringPath' that appears in the path. - Required. - :type global_string_path: str - :keyword path_item_string_query: should contain value null. Default value is None. - :paramtype path_item_string_query: str - :keyword local_string_query: should contain value null. Default value is None. - :paramtype local_string_query: str - :keyword global_string_query: should contain value null. Default value is None. - :paramtype global_string_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/pathitem/nullable/globalStringPath/{globalStringPath}/pathItemStringPath/{pathItemStringPath}/localStringPath/{localStringPath}/globalStringQuery/null/null" # pylint: disable=line-too-long - path_format_arguments = { - "pathItemStringPath": _SERIALIZER.url("path_item_string_path", path_item_string_path, 'str'), - "globalStringPath": _SERIALIZER.url("global_string_path", global_string_path, 'str'), - "localStringPath": _SERIALIZER.url("local_string_path", local_string_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - if path_item_string_query is not None: - _params['pathItemStringQuery'] = _SERIALIZER.query("path_item_string_query", path_item_string_query, 'str') - if global_string_query is not None: - _params['globalStringQuery'] = _SERIALIZER.query("global_string_query", global_string_query, 'str') - if local_string_query is not None: - _params['localStringQuery'] = _SERIALIZER.query("local_string_query", local_string_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/__init__.py index 5f24a088959..28cfd1efc0a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/__init__.py @@ -6,62 +6,33 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_boolean_true_request - from ._request_builders_py3 import build_get_boolean_false_request - from ._request_builders_py3 import build_get_int_one_million_request - from ._request_builders_py3 import build_get_int_negative_one_million_request - from ._request_builders_py3 import build_get_ten_billion_request - from ._request_builders_py3 import build_get_negative_ten_billion_request - from ._request_builders_py3 import build_float_scientific_positive_request - from ._request_builders_py3 import build_float_scientific_negative_request - from ._request_builders_py3 import build_double_decimal_positive_request - from ._request_builders_py3 import build_double_decimal_negative_request - from ._request_builders_py3 import build_string_unicode_request - from ._request_builders_py3 import build_string_url_encoded_request - from ._request_builders_py3 import build_string_url_non_encoded_request - from ._request_builders_py3 import build_string_empty_request - from ._request_builders_py3 import build_string_null_request - from ._request_builders_py3 import build_enum_valid_request - from ._request_builders_py3 import build_enum_null_request - from ._request_builders_py3 import build_byte_multi_byte_request - from ._request_builders_py3 import build_byte_empty_request - from ._request_builders_py3 import build_byte_null_request - from ._request_builders_py3 import build_date_valid_request - from ._request_builders_py3 import build_date_null_request - from ._request_builders_py3 import build_date_time_valid_request - from ._request_builders_py3 import build_date_time_null_request - from ._request_builders_py3 import build_base64_url_request - from ._request_builders_py3 import build_array_csv_in_path_request - from ._request_builders_py3 import build_unix_time_url_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_boolean_true_request # type: ignore - from ._request_builders import build_get_boolean_false_request # type: ignore - from ._request_builders import build_get_int_one_million_request # type: ignore - from ._request_builders import build_get_int_negative_one_million_request # type: ignore - from ._request_builders import build_get_ten_billion_request # type: ignore - from ._request_builders import build_get_negative_ten_billion_request # type: ignore - from ._request_builders import build_float_scientific_positive_request # type: ignore - from ._request_builders import build_float_scientific_negative_request # type: ignore - from ._request_builders import build_double_decimal_positive_request # type: ignore - from ._request_builders import build_double_decimal_negative_request # type: ignore - from ._request_builders import build_string_unicode_request # type: ignore - from ._request_builders import build_string_url_encoded_request # type: ignore - from ._request_builders import build_string_url_non_encoded_request # type: ignore - from ._request_builders import build_string_empty_request # type: ignore - from ._request_builders import build_string_null_request # type: ignore - from ._request_builders import build_enum_valid_request # type: ignore - from ._request_builders import build_enum_null_request # type: ignore - from ._request_builders import build_byte_multi_byte_request # type: ignore - from ._request_builders import build_byte_empty_request # type: ignore - from ._request_builders import build_byte_null_request # type: ignore - from ._request_builders import build_date_valid_request # type: ignore - from ._request_builders import build_date_null_request # type: ignore - from ._request_builders import build_date_time_valid_request # type: ignore - from ._request_builders import build_date_time_null_request # type: ignore - from ._request_builders import build_base64_url_request # type: ignore - from ._request_builders import build_array_csv_in_path_request # type: ignore - from ._request_builders import build_unix_time_url_request # type: ignore +from ._request_builders import build_get_boolean_true_request +from ._request_builders import build_get_boolean_false_request +from ._request_builders import build_get_int_one_million_request +from ._request_builders import build_get_int_negative_one_million_request +from ._request_builders import build_get_ten_billion_request +from ._request_builders import build_get_negative_ten_billion_request +from ._request_builders import build_float_scientific_positive_request +from ._request_builders import build_float_scientific_negative_request +from ._request_builders import build_double_decimal_positive_request +from ._request_builders import build_double_decimal_negative_request +from ._request_builders import build_string_unicode_request +from ._request_builders import build_string_url_encoded_request +from ._request_builders import build_string_url_non_encoded_request +from ._request_builders import build_string_empty_request +from ._request_builders import build_string_null_request +from ._request_builders import build_enum_valid_request +from ._request_builders import build_enum_null_request +from ._request_builders import build_byte_multi_byte_request +from ._request_builders import build_byte_empty_request +from ._request_builders import build_byte_null_request +from ._request_builders import build_date_valid_request +from ._request_builders import build_date_null_request +from ._request_builders import build_date_time_valid_request +from ._request_builders import build_date_time_null_request +from ._request_builders import build_base64_url_request +from ._request_builders import build_array_csv_in_path_request +from ._request_builders import build_unix_time_url_request __all__ = [ "build_get_boolean_true_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders.py index bb36935b02d..68f1a61294b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders.py @@ -17,12 +17,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_boolean_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_true_request(**kwargs: Any) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -39,32 +35,24 @@ def build_get_boolean_true_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - bool_path = kwargs.pop('bool_path', True) # type: bool - accept = _headers.pop('Accept', "application/json") + bool_path = kwargs.pop("bool_path", True) # type: bool + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/bool/true/{boolPath}" path_format_arguments = { - "boolPath": _SERIALIZER.url("bool_path", bool_path, 'bool'), + "boolPath": _SERIALIZER.url("bool_path", bool_path, "bool"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_boolean_false_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_false_request(**kwargs: Any) -> HttpRequest: """Get false Boolean value on path. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -81,32 +69,24 @@ def build_get_boolean_false_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - bool_path = kwargs.pop('bool_path', False) # type: bool - accept = _headers.pop('Accept', "application/json") + bool_path = kwargs.pop("bool_path", False) # type: bool + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/bool/false/{boolPath}" path_format_arguments = { - "boolPath": _SERIALIZER.url("bool_path", bool_path, 'bool'), + "boolPath": _SERIALIZER.url("bool_path", bool_path, "bool"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_int_one_million_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_one_million_request(**kwargs: Any) -> HttpRequest: """Get '1000000' integer value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -123,32 +103,24 @@ def build_get_int_one_million_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - int_path = kwargs.pop('int_path', 1000000) # type: int - accept = _headers.pop('Accept', "application/json") + int_path = kwargs.pop("int_path", 1000000) # type: int + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/int/1000000/{intPath}" path_format_arguments = { - "intPath": _SERIALIZER.url("int_path", int_path, 'int'), + "intPath": _SERIALIZER.url("int_path", int_path, "int"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_int_negative_one_million_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_negative_one_million_request(**kwargs: Any) -> HttpRequest: """Get '-1000000' integer value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -165,32 +137,24 @@ def build_get_int_negative_one_million_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - int_path = kwargs.pop('int_path', -1000000) # type: int - accept = _headers.pop('Accept', "application/json") + int_path = kwargs.pop("int_path", -1000000) # type: int + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/int/-1000000/{intPath}" path_format_arguments = { - "intPath": _SERIALIZER.url("int_path", int_path, 'int'), + "intPath": _SERIALIZER.url("int_path", int_path, "int"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_ten_billion_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_ten_billion_request(**kwargs: Any) -> HttpRequest: """Get '10000000000' 64 bit integer value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -207,32 +171,24 @@ def build_get_ten_billion_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - long_path = kwargs.pop('long_path', 10000000000) # type: int - accept = _headers.pop('Accept', "application/json") + long_path = kwargs.pop("long_path", 10000000000) # type: int + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/long/10000000000/{longPath}" path_format_arguments = { - "longPath": _SERIALIZER.url("long_path", long_path, 'int'), + "longPath": _SERIALIZER.url("long_path", long_path, "int"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_negative_ten_billion_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_negative_ten_billion_request(**kwargs: Any) -> HttpRequest: """Get '-10000000000' 64 bit integer value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -249,32 +205,24 @@ def build_get_negative_ten_billion_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - long_path = kwargs.pop('long_path', -10000000000) # type: int - accept = _headers.pop('Accept', "application/json") + long_path = kwargs.pop("long_path", -10000000000) # type: int + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/long/-10000000000/{longPath}" path_format_arguments = { - "longPath": _SERIALIZER.url("long_path", long_path, 'int'), + "longPath": _SERIALIZER.url("long_path", long_path, "int"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_float_scientific_positive_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_float_scientific_positive_request(**kwargs: Any) -> HttpRequest: """Get '1.034E+20' numeric value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -291,32 +239,24 @@ def build_float_scientific_positive_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - float_path = kwargs.pop('float_path', 103400000000000000000) # type: float - accept = _headers.pop('Accept', "application/json") + float_path = kwargs.pop("float_path", 103400000000000000000) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/float/1.034E+20/{floatPath}" path_format_arguments = { - "floatPath": _SERIALIZER.url("float_path", float_path, 'float'), + "floatPath": _SERIALIZER.url("float_path", float_path, "float"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_float_scientific_negative_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_float_scientific_negative_request(**kwargs: Any) -> HttpRequest: """Get '-1.034E-20' numeric value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -333,32 +273,24 @@ def build_float_scientific_negative_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - float_path = kwargs.pop('float_path', -1.034e-20) # type: float - accept = _headers.pop('Accept', "application/json") + float_path = kwargs.pop("float_path", -1.034e-20) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/float/-1.034E-20/{floatPath}" path_format_arguments = { - "floatPath": _SERIALIZER.url("float_path", float_path, 'float'), + "floatPath": _SERIALIZER.url("float_path", float_path, "float"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_double_decimal_positive_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_double_decimal_positive_request(**kwargs: Any) -> HttpRequest: """Get '9999999.999' numeric value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -375,32 +307,24 @@ def build_double_decimal_positive_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - double_path = kwargs.pop('double_path', 9999999.999) # type: float - accept = _headers.pop('Accept', "application/json") + double_path = kwargs.pop("double_path", 9999999.999) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/double/9999999.999/{doublePath}" path_format_arguments = { - "doublePath": _SERIALIZER.url("double_path", double_path, 'float'), + "doublePath": _SERIALIZER.url("double_path", double_path, "float"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_double_decimal_negative_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_double_decimal_negative_request(**kwargs: Any) -> HttpRequest: """Get '-9999999.999' numeric value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -417,32 +341,24 @@ def build_double_decimal_negative_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - double_path = kwargs.pop('double_path', -9999999.999) # type: float - accept = _headers.pop('Accept', "application/json") + double_path = kwargs.pop("double_path", -9999999.999) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/double/-9999999.999/{doublePath}" path_format_arguments = { - "doublePath": _SERIALIZER.url("double_path", double_path, 'float'), + "doublePath": _SERIALIZER.url("double_path", double_path, "float"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_string_unicode_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_unicode_request(**kwargs: Any) -> HttpRequest: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -459,32 +375,24 @@ def build_string_unicode_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - string_path = kwargs.pop('string_path', "啊齄丂狛狜隣郎隣兀﨩") # type: str - accept = _headers.pop('Accept', "application/json") + string_path = kwargs.pop("string_path", "啊齄丂狛狜隣郎隣兀﨩") # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/string/unicode/{stringPath}" path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), + "stringPath": _SERIALIZER.url("string_path", string_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_string_url_encoded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_url_encoded_request(**kwargs: Any) -> HttpRequest: """Get 'begin!*'();:@ &=+$,/?#[]end. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -502,32 +410,24 @@ def build_string_url_encoded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - string_path = kwargs.pop('string_path', "begin!*'();:@ &=+$,/?#[]end") # type: str - accept = _headers.pop('Accept', "application/json") + string_path = kwargs.pop("string_path", "begin!*'();:@ &=+$,/?#[]end") # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}" path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), + "stringPath": _SERIALIZER.url("string_path", string_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_string_url_non_encoded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_url_non_encoded_request(**kwargs: Any) -> HttpRequest: """Get 'begin!*'();:@&=+$,end. https://tools.ietf.org/html/rfc3986#appendix-A 'path' accept any 'pchar' not encoded. @@ -547,32 +447,24 @@ def build_string_url_non_encoded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - string_path = kwargs.pop('string_path', "begin!*'();:@&=+$,end") # type: str - accept = _headers.pop('Accept', "application/json") + string_path = kwargs.pop("string_path", "begin!*'();:@&=+$,end") # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/paths/string/begin!*\'();:@&=+$,end/{stringPath}" + _url = "/paths/string/begin!*'();:@&=+$,end/{stringPath}" path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str', skip_quote=True), + "stringPath": _SERIALIZER.url("string_path", string_path, "str", skip_quote=True), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_string_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_empty_request(**kwargs: Any) -> HttpRequest: """Get ''. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -589,33 +481,24 @@ def build_string_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - string_path = kwargs.pop('string_path', "") # type: str - accept = _headers.pop('Accept', "application/json") + string_path = kwargs.pop("string_path", "") # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/string/empty/{stringPath}" path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), + "stringPath": _SERIALIZER.url("string_path", string_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_string_null_request( - string_path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_null_request(string_path: str, **kwargs: Any) -> HttpRequest: """Get null (should throw). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -631,32 +514,23 @@ def build_string_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/string/null/{stringPath}" path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), + "stringPath": _SERIALIZER.url("string_path", string_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_enum_valid_request( - enum_path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_enum_valid_request(enum_path: str, **kwargs: Any) -> HttpRequest: """Get using uri with 'green color' in path parameter. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -673,32 +547,23 @@ def build_enum_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/enum/green%20color/{enumPath}" path_format_arguments = { - "enumPath": _SERIALIZER.url("enum_path", enum_path, 'str'), + "enumPath": _SERIALIZER.url("enum_path", enum_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_enum_null_request( - enum_path, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_enum_null_request(enum_path: str, **kwargs: Any) -> HttpRequest: """Get null (should throw on the client before the request is sent on wire). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -715,32 +580,23 @@ def build_enum_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/string/null/{enumPath}" path_format_arguments = { - "enumPath": _SERIALIZER.url("enum_path", enum_path, 'str'), + "enumPath": _SERIALIZER.url("enum_path", enum_path, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_byte_multi_byte_request( - byte_path, # type: bytes - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_byte_multi_byte_request(byte_path: bytes, **kwargs: Any) -> HttpRequest: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -756,31 +612,23 @@ def build_byte_multi_byte_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/byte/multibyte/{bytePath}" path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), + "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_byte_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_byte_empty_request(**kwargs: Any) -> HttpRequest: """Get '' as byte array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -797,33 +645,24 @@ def build_byte_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - byte_path = kwargs.pop('byte_path', bytes("", encoding="utf-8")) # type: bytes - accept = _headers.pop('Accept', "application/json") + byte_path = kwargs.pop("byte_path", bytes("", encoding="utf-8")) # type: bytes + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/byte/empty/{bytePath}" path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), + "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_byte_null_request( - byte_path, # type: bytes - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_byte_null_request(byte_path: bytes, **kwargs: Any) -> HttpRequest: """Get null as byte array (should throw). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -839,31 +678,23 @@ def build_byte_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/byte/null/{bytePath}" path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), + "bytePath": _SERIALIZER.url("byte_path", byte_path, "bytearray"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_date_valid_request(**kwargs: Any) -> HttpRequest: """Get '2012-01-01' as date. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -880,33 +711,24 @@ def build_date_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - date_path = kwargs.pop('date_path', "2012-01-01") # type: datetime.date - accept = _headers.pop('Accept', "application/json") + date_path = kwargs.pop("date_path", "2012-01-01") # type: datetime.date + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/date/2012-01-01/{datePath}" path_format_arguments = { - "datePath": _SERIALIZER.url("date_path", date_path, 'date'), + "datePath": _SERIALIZER.url("date_path", date_path, "date"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_date_null_request( - date_path, # type: datetime.date - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_date_null_request(date_path: datetime.date, **kwargs: Any) -> HttpRequest: """Get null as date - this should throw or be unusable on the client side, depending on date representation. @@ -923,31 +745,23 @@ def build_date_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/date/null/{datePath}" path_format_arguments = { - "datePath": _SERIALIZER.url("date_path", date_path, 'date'), + "datePath": _SERIALIZER.url("date_path", date_path, "date"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_date_time_valid_request(**kwargs: Any) -> HttpRequest: """Get '2012-01-01T01:01:01Z' as date-time. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -965,33 +779,24 @@ def build_date_time_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - date_time_path = kwargs.pop('date_time_path', "2012-01-01T01:01:01Z") # type: datetime.datetime - accept = _headers.pop('Accept', "application/json") + date_time_path = kwargs.pop("date_time_path", "2012-01-01T01:01:01Z") # type: datetime.datetime + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}" path_format_arguments = { - "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, 'iso-8601'), + "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, "iso-8601"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_date_time_null_request( - date_time_path, # type: datetime.datetime - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_date_time_null_request(date_time_path: datetime.datetime, **kwargs: Any) -> HttpRequest: """Get null as date-time, should be disallowed or throw depending on representation of date-time. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1007,32 +812,23 @@ def build_date_time_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/datetime/null/{dateTimePath}" path_format_arguments = { - "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, 'iso-8601'), + "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, "iso-8601"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_base64_url_request( - base64_url_path, # type: bytes - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_base64_url_request(base64_url_path: bytes, **kwargs: Any) -> HttpRequest: """Get 'lorem' encoded value as 'bG9yZW0' (base64url). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1048,32 +844,23 @@ def build_base64_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/string/bG9yZW0/{base64UrlPath}" path_format_arguments = { - "base64UrlPath": _SERIALIZER.url("base64_url_path", base64_url_path, 'base64'), + "base64UrlPath": _SERIALIZER.url("base64_url_path", base64_url_path, "base64"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_array_csv_in_path_request( - array_path, # type: List[str] - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_csv_in_path_request(array_path: List[str], **kwargs: Any) -> HttpRequest: """Get an array of string ['ArrayPath1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -1091,32 +878,25 @@ def build_array_csv_in_path_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}" + _url = ( + "/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}" + ) path_format_arguments = { - "arrayPath": _SERIALIZER.url("array_path", array_path, '[str]', div=','), + "arrayPath": _SERIALIZER.url("array_path", array_path, "[str]", div=","), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_unix_time_url_request( - unix_time_url_path, # type: datetime.datetime - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_unix_time_url_request(unix_time_url_path: datetime.datetime, **kwargs: Any) -> HttpRequest: """Get the date 2016-04-13 encoded value as '1460505600' (Unix time). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1132,22 +912,17 @@ def build_unix_time_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/paths/int/1460505600/{unixTimeUrlPath}" path_format_arguments = { - "unixTimeUrlPath": _SERIALIZER.url("unix_time_url_path", unix_time_url_path, 'unix-time'), + "unixTimeUrlPath": _SERIALIZER.url("unix_time_url_path", unix_time_url_path, "unix-time"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders_py3.py deleted file mode 100644 index 5c1447921c3..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/paths/_request_builders_py3.py +++ /dev/null @@ -1,1126 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, List - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_boolean_true_request( - **kwargs: Any -) -> HttpRequest: - """Get true Boolean value on path. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword bool_path: true boolean value. Default value is True. Note that overriding this - default value may result in unsupported behavior. - :paramtype bool_path: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - bool_path = kwargs.pop('bool_path', True) # type: bool - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/bool/true/{boolPath}" - path_format_arguments = { - "boolPath": _SERIALIZER.url("bool_path", bool_path, 'bool'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_false_request( - **kwargs: Any -) -> HttpRequest: - """Get false Boolean value on path. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword bool_path: false boolean value. Required. Default value is False. Note that overriding - this default value may result in unsupported behavior. - :paramtype bool_path: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - bool_path = kwargs.pop('bool_path', False) # type: bool - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/bool/false/{boolPath}" - path_format_arguments = { - "boolPath": _SERIALIZER.url("bool_path", bool_path, 'bool'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_int_one_million_request( - **kwargs: Any -) -> HttpRequest: - """Get '1000000' integer value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword int_path: '1000000' integer value. Default value is 1000000. Note that overriding this - default value may result in unsupported behavior. - :paramtype int_path: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - int_path = kwargs.pop('int_path', 1000000) # type: int - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/int/1000000/{intPath}" - path_format_arguments = { - "intPath": _SERIALIZER.url("int_path", int_path, 'int'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_int_negative_one_million_request( - **kwargs: Any -) -> HttpRequest: - """Get '-1000000' integer value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword int_path: '-1000000' integer value. Default value is -1000000. Note that overriding - this default value may result in unsupported behavior. - :paramtype int_path: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - int_path = kwargs.pop('int_path', -1000000) # type: int - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/int/-1000000/{intPath}" - path_format_arguments = { - "intPath": _SERIALIZER.url("int_path", int_path, 'int'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_ten_billion_request( - **kwargs: Any -) -> HttpRequest: - """Get '10000000000' 64 bit integer value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword long_path: '10000000000' 64 bit integer value. Default value is 10000000000. Note that - overriding this default value may result in unsupported behavior. - :paramtype long_path: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - long_path = kwargs.pop('long_path', 10000000000) # type: int - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/long/10000000000/{longPath}" - path_format_arguments = { - "longPath": _SERIALIZER.url("long_path", long_path, 'int'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_negative_ten_billion_request( - **kwargs: Any -) -> HttpRequest: - """Get '-10000000000' 64 bit integer value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword long_path: '-10000000000' 64 bit integer value. Default value is -10000000000. Note - that overriding this default value may result in unsupported behavior. - :paramtype long_path: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - long_path = kwargs.pop('long_path', -10000000000) # type: int - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/long/-10000000000/{longPath}" - path_format_arguments = { - "longPath": _SERIALIZER.url("long_path", long_path, 'int'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_float_scientific_positive_request( - **kwargs: Any -) -> HttpRequest: - """Get '1.034E+20' numeric value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword float_path: '1.034E+20'numeric value. Default value is 103400000000000000000. Note - that overriding this default value may result in unsupported behavior. - :paramtype float_path: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - float_path = kwargs.pop('float_path', 103400000000000000000) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/float/1.034E+20/{floatPath}" - path_format_arguments = { - "floatPath": _SERIALIZER.url("float_path", float_path, 'float'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_float_scientific_negative_request( - **kwargs: Any -) -> HttpRequest: - """Get '-1.034E-20' numeric value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword float_path: '-1.034E-20'numeric value. Default value is -1.034e-20. Note that - overriding this default value may result in unsupported behavior. - :paramtype float_path: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - float_path = kwargs.pop('float_path', -1.034e-20) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/float/-1.034E-20/{floatPath}" - path_format_arguments = { - "floatPath": _SERIALIZER.url("float_path", float_path, 'float'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_double_decimal_positive_request( - **kwargs: Any -) -> HttpRequest: - """Get '9999999.999' numeric value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword double_path: '9999999.999'numeric value. Default value is 9999999.999. Note that - overriding this default value may result in unsupported behavior. - :paramtype double_path: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - double_path = kwargs.pop('double_path', 9999999.999) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/double/9999999.999/{doublePath}" - path_format_arguments = { - "doublePath": _SERIALIZER.url("double_path", double_path, 'float'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_double_decimal_negative_request( - **kwargs: Any -) -> HttpRequest: - """Get '-9999999.999' numeric value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword double_path: '-9999999.999'numeric value. Default value is -9999999.999. Note that - overriding this default value may result in unsupported behavior. - :paramtype double_path: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - double_path = kwargs.pop('double_path', -9999999.999) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/double/-9999999.999/{doublePath}" - path_format_arguments = { - "doublePath": _SERIALIZER.url("double_path", double_path, 'float'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_string_unicode_request( - **kwargs: Any -) -> HttpRequest: - """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword string_path: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Default value is "啊齄丂狛狜隣郎隣兀﨩". Note - that overriding this default value may result in unsupported behavior. - :paramtype string_path: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - string_path = kwargs.pop('string_path', "啊齄丂狛狜隣郎隣兀﨩") # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/string/unicode/{stringPath}" - path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_string_url_encoded_request( - **kwargs: Any -) -> HttpRequest: - """Get 'begin!*'();:@ &=+$,/?#[]end. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword string_path: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. Default value is - "begin!*'();:@ &=+$,/?#[]end". Note that overriding this default value may result in - unsupported behavior. - :paramtype string_path: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - string_path = kwargs.pop('string_path', "begin!*'();:@ &=+$,/?#[]end") # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend/{stringPath}" - path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_string_url_non_encoded_request( - **kwargs: Any -) -> HttpRequest: - """Get 'begin!*'();:@&=+$,end. - - https://tools.ietf.org/html/rfc3986#appendix-A 'path' accept any 'pchar' not encoded. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword string_path: 'begin!*'();:@&=+$,end' url encoded string value. Default value is - "begin!*'();:@&=+$,end". Note that overriding this default value may result in unsupported - behavior. - :paramtype string_path: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - string_path = kwargs.pop('string_path', "begin!*'();:@&=+$,end") # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/string/begin!*\'();:@&=+$,end/{stringPath}" - path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str', skip_quote=True), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_string_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get ''. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword string_path: '' string value. Required. Default value is "". Note that overriding this - default value may result in unsupported behavior. - :paramtype string_path: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - string_path = kwargs.pop('string_path', "") # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/string/empty/{stringPath}" - path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_string_null_request( - string_path: str, - **kwargs: Any -) -> HttpRequest: - """Get null (should throw). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param string_path: null string value. Required. - :type string_path: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/string/null/{stringPath}" - path_format_arguments = { - "stringPath": _SERIALIZER.url("string_path", string_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_enum_valid_request( - enum_path: str, - **kwargs: Any -) -> HttpRequest: - """Get using uri with 'green color' in path parameter. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param enum_path: send the value green. Known values are: "red color", "green color", and "blue - color". Required. - :type enum_path: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/enum/green%20color/{enumPath}" - path_format_arguments = { - "enumPath": _SERIALIZER.url("enum_path", enum_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_enum_null_request( - enum_path: str, - **kwargs: Any -) -> HttpRequest: - """Get null (should throw on the client before the request is sent on wire). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param enum_path: send null should throw. Known values are: "red color", "green color", and - "blue color". Required. - :type enum_path: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/string/null/{enumPath}" - path_format_arguments = { - "enumPath": _SERIALIZER.url("enum_path", enum_path, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_byte_multi_byte_request( - byte_path: bytes, - **kwargs: Any -) -> HttpRequest: - """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param byte_path: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. Required. - :type byte_path: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/byte/multibyte/{bytePath}" - path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_byte_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get '' as byte array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword byte_path: '' as byte array. Required. Default value is bytes("", encoding="utf-8"). - Note that overriding this default value may result in unsupported behavior. - :paramtype byte_path: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - byte_path = kwargs.pop('byte_path', bytes("", encoding="utf-8")) # type: bytes - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/byte/empty/{bytePath}" - path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_byte_null_request( - byte_path: bytes, - **kwargs: Any -) -> HttpRequest: - """Get null as byte array (should throw). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param byte_path: null as byte array (should throw). Required. - :type byte_path: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/byte/null/{bytePath}" - path_format_arguments = { - "bytePath": _SERIALIZER.url("byte_path", byte_path, 'bytearray'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_date_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get '2012-01-01' as date. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword date_path: '2012-01-01' as date. Default value is "2012-01-01". Note that overriding - this default value may result in unsupported behavior. - :paramtype date_path: ~datetime.date - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - date_path = kwargs.pop('date_path', "2012-01-01") # type: datetime.date - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/date/2012-01-01/{datePath}" - path_format_arguments = { - "datePath": _SERIALIZER.url("date_path", date_path, 'date'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_date_null_request( - date_path: datetime.date, - **kwargs: Any -) -> HttpRequest: - """Get null as date - this should throw or be unusable on the client side, depending on date - representation. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param date_path: null as date (should throw). Required. - :type date_path: ~datetime.date - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/date/null/{datePath}" - path_format_arguments = { - "datePath": _SERIALIZER.url("date_path", date_path, 'date'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_date_time_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get '2012-01-01T01:01:01Z' as date-time. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword date_time_path: '2012-01-01T01:01:01Z' as date-time. Default value is - "2012-01-01T01:01:01Z". Note that overriding this default value may result in unsupported - behavior. - :paramtype date_time_path: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - date_time_path = kwargs.pop('date_time_path', "2012-01-01T01:01:01Z") # type: datetime.datetime - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/datetime/2012-01-01T01%3A01%3A01Z/{dateTimePath}" - path_format_arguments = { - "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, 'iso-8601'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_date_time_null_request( - date_time_path: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Get null as date-time, should be disallowed or throw depending on representation of date-time. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param date_time_path: null as date-time. Required. - :type date_time_path: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/datetime/null/{dateTimePath}" - path_format_arguments = { - "dateTimePath": _SERIALIZER.url("date_time_path", date_time_path, 'iso-8601'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_base64_url_request( - base64_url_path: bytes, - **kwargs: Any -) -> HttpRequest: - """Get 'lorem' encoded value as 'bG9yZW0' (base64url). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param base64_url_path: base64url encoded value. Required. - :type base64_url_path: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/string/bG9yZW0/{base64UrlPath}" - path_format_arguments = { - "base64UrlPath": _SERIALIZER.url("base64_url_path", base64_url_path, 'base64'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_array_csv_in_path_request( - array_path: List[str], - **kwargs: Any -) -> HttpRequest: - """Get an array of string ['ArrayPath1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the - csv-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param array_path: an array of string ['ArrayPath1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] - using the csv-array format. Required. - :type array_path: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/array/ArrayPath1%2cbegin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend%2c%2c/{arrayPath}" - path_format_arguments = { - "arrayPath": _SERIALIZER.url("array_path", array_path, '[str]', div=','), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_unix_time_url_request( - unix_time_url_path: datetime.datetime, - **kwargs: Any -) -> HttpRequest: - """Get the date 2016-04-13 encoded value as '1460505600' (Unix time). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param unix_time_url_path: Unix time encoded value. Required. - :type unix_time_url_path: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/paths/int/1460505600/{unixTimeUrlPath}" - path_format_arguments = { - "unixTimeUrlPath": _SERIALIZER.url("unix_time_url_path", unix_time_url_path, 'unix-time'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/__init__.py index 3017ee4219d..b12dab2a4ae 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/__init__.py @@ -6,78 +6,41 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_boolean_true_request - from ._request_builders_py3 import build_get_boolean_false_request - from ._request_builders_py3 import build_get_boolean_null_request - from ._request_builders_py3 import build_get_int_one_million_request - from ._request_builders_py3 import build_get_int_negative_one_million_request - from ._request_builders_py3 import build_get_int_null_request - from ._request_builders_py3 import build_get_ten_billion_request - from ._request_builders_py3 import build_get_negative_ten_billion_request - from ._request_builders_py3 import build_get_long_null_request - from ._request_builders_py3 import build_float_scientific_positive_request - from ._request_builders_py3 import build_float_scientific_negative_request - from ._request_builders_py3 import build_float_null_request - from ._request_builders_py3 import build_double_decimal_positive_request - from ._request_builders_py3 import build_double_decimal_negative_request - from ._request_builders_py3 import build_double_null_request - from ._request_builders_py3 import build_string_unicode_request - from ._request_builders_py3 import build_string_url_encoded_request - from ._request_builders_py3 import build_string_empty_request - from ._request_builders_py3 import build_string_null_request - from ._request_builders_py3 import build_enum_valid_request - from ._request_builders_py3 import build_enum_null_request - from ._request_builders_py3 import build_byte_multi_byte_request - from ._request_builders_py3 import build_byte_empty_request - from ._request_builders_py3 import build_byte_null_request - from ._request_builders_py3 import build_date_valid_request - from ._request_builders_py3 import build_date_null_request - from ._request_builders_py3 import build_date_time_valid_request - from ._request_builders_py3 import build_date_time_null_request - from ._request_builders_py3 import build_array_string_csv_valid_request - from ._request_builders_py3 import build_array_string_csv_null_request - from ._request_builders_py3 import build_array_string_csv_empty_request - from ._request_builders_py3 import build_array_string_no_collection_format_empty_request - from ._request_builders_py3 import build_array_string_ssv_valid_request - from ._request_builders_py3 import build_array_string_tsv_valid_request - from ._request_builders_py3 import build_array_string_pipes_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_boolean_true_request # type: ignore - from ._request_builders import build_get_boolean_false_request # type: ignore - from ._request_builders import build_get_boolean_null_request # type: ignore - from ._request_builders import build_get_int_one_million_request # type: ignore - from ._request_builders import build_get_int_negative_one_million_request # type: ignore - from ._request_builders import build_get_int_null_request # type: ignore - from ._request_builders import build_get_ten_billion_request # type: ignore - from ._request_builders import build_get_negative_ten_billion_request # type: ignore - from ._request_builders import build_get_long_null_request # type: ignore - from ._request_builders import build_float_scientific_positive_request # type: ignore - from ._request_builders import build_float_scientific_negative_request # type: ignore - from ._request_builders import build_float_null_request # type: ignore - from ._request_builders import build_double_decimal_positive_request # type: ignore - from ._request_builders import build_double_decimal_negative_request # type: ignore - from ._request_builders import build_double_null_request # type: ignore - from ._request_builders import build_string_unicode_request # type: ignore - from ._request_builders import build_string_url_encoded_request # type: ignore - from ._request_builders import build_string_empty_request # type: ignore - from ._request_builders import build_string_null_request # type: ignore - from ._request_builders import build_enum_valid_request # type: ignore - from ._request_builders import build_enum_null_request # type: ignore - from ._request_builders import build_byte_multi_byte_request # type: ignore - from ._request_builders import build_byte_empty_request # type: ignore - from ._request_builders import build_byte_null_request # type: ignore - from ._request_builders import build_date_valid_request # type: ignore - from ._request_builders import build_date_null_request # type: ignore - from ._request_builders import build_date_time_valid_request # type: ignore - from ._request_builders import build_date_time_null_request # type: ignore - from ._request_builders import build_array_string_csv_valid_request # type: ignore - from ._request_builders import build_array_string_csv_null_request # type: ignore - from ._request_builders import build_array_string_csv_empty_request # type: ignore - from ._request_builders import build_array_string_no_collection_format_empty_request # type: ignore - from ._request_builders import build_array_string_ssv_valid_request # type: ignore - from ._request_builders import build_array_string_tsv_valid_request # type: ignore - from ._request_builders import build_array_string_pipes_valid_request # type: ignore +from ._request_builders import build_get_boolean_true_request +from ._request_builders import build_get_boolean_false_request +from ._request_builders import build_get_boolean_null_request +from ._request_builders import build_get_int_one_million_request +from ._request_builders import build_get_int_negative_one_million_request +from ._request_builders import build_get_int_null_request +from ._request_builders import build_get_ten_billion_request +from ._request_builders import build_get_negative_ten_billion_request +from ._request_builders import build_get_long_null_request +from ._request_builders import build_float_scientific_positive_request +from ._request_builders import build_float_scientific_negative_request +from ._request_builders import build_float_null_request +from ._request_builders import build_double_decimal_positive_request +from ._request_builders import build_double_decimal_negative_request +from ._request_builders import build_double_null_request +from ._request_builders import build_string_unicode_request +from ._request_builders import build_string_url_encoded_request +from ._request_builders import build_string_empty_request +from ._request_builders import build_string_null_request +from ._request_builders import build_enum_valid_request +from ._request_builders import build_enum_null_request +from ._request_builders import build_byte_multi_byte_request +from ._request_builders import build_byte_empty_request +from ._request_builders import build_byte_null_request +from ._request_builders import build_date_valid_request +from ._request_builders import build_date_null_request +from ._request_builders import build_date_time_valid_request +from ._request_builders import build_date_time_null_request +from ._request_builders import build_array_string_csv_valid_request +from ._request_builders import build_array_string_csv_null_request +from ._request_builders import build_array_string_csv_empty_request +from ._request_builders import build_array_string_no_collection_format_empty_request +from ._request_builders import build_array_string_ssv_valid_request +from ._request_builders import build_array_string_tsv_valid_request +from ._request_builders import build_array_string_pipes_valid_request __all__ = [ "build_get_boolean_true_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders.py index 26e46eee565..aa74628d822 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders.py @@ -16,12 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_boolean_true_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_true_request(**kwargs: Any) -> HttpRequest: """Get true Boolean value on path. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -39,31 +35,22 @@ def build_get_boolean_true_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - bool_query = kwargs.pop('bool_query', _params.pop('boolQuery', True)) # type: bool - accept = _headers.pop('Accept', "application/json") + bool_query = kwargs.pop("bool_query", _params.pop("boolQuery", True)) # type: bool + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/bool/true" # Construct parameters - _params['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') + _params["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_boolean_false_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_false_request(**kwargs: Any) -> HttpRequest: """Get false Boolean value on path. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -81,31 +68,22 @@ def build_get_boolean_false_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - bool_query = kwargs.pop('bool_query', _params.pop('boolQuery', False)) # type: bool - accept = _headers.pop('Accept', "application/json") + bool_query = kwargs.pop("bool_query", _params.pop("boolQuery", False)) # type: bool + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/bool/false" # Construct parameters - _params['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') + _params["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_boolean_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_boolean_null_request(*, bool_query: Optional[bool] = None, **kwargs: Any) -> HttpRequest: """Get null Boolean value on query (query string should be absent). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -122,32 +100,22 @@ def build_get_boolean_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - bool_query = kwargs.pop('bool_query', _params.pop('boolQuery', None)) # type: Optional[bool] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/bool/null" # Construct parameters if bool_query is not None: - _params['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') + _params["boolQuery"] = _SERIALIZER.query("bool_query", bool_query, "bool") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_int_one_million_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_one_million_request(**kwargs: Any) -> HttpRequest: """Get '1000000' integer value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -165,31 +133,22 @@ def build_get_int_one_million_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - int_query = kwargs.pop('int_query', _params.pop('intQuery', 1000000)) # type: int - accept = _headers.pop('Accept', "application/json") + int_query = kwargs.pop("int_query", _params.pop("intQuery", 1000000)) # type: int + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/int/1000000" # Construct parameters - _params['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') + _params["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_int_negative_one_million_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_negative_one_million_request(**kwargs: Any) -> HttpRequest: """Get '-1000000' integer value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -207,31 +166,22 @@ def build_get_int_negative_one_million_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - int_query = kwargs.pop('int_query', _params.pop('intQuery', -1000000)) # type: int - accept = _headers.pop('Accept', "application/json") + int_query = kwargs.pop("int_query", _params.pop("intQuery", -1000000)) # type: int + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/int/-1000000" # Construct parameters - _params['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') + _params["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_int_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_int_null_request(*, int_query: Optional[int] = None, **kwargs: Any) -> HttpRequest: """Get null integer value (no query parameter). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -248,32 +198,22 @@ def build_get_int_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - int_query = kwargs.pop('int_query', _params.pop('intQuery', None)) # type: Optional[int] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/int/null" # Construct parameters if int_query is not None: - _params['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') + _params["intQuery"] = _SERIALIZER.query("int_query", int_query, "int") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_ten_billion_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_ten_billion_request(**kwargs: Any) -> HttpRequest: """Get '10000000000' 64 bit integer value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -291,31 +231,22 @@ def build_get_ten_billion_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - long_query = kwargs.pop('long_query', _params.pop('longQuery', 10000000000)) # type: int - accept = _headers.pop('Accept', "application/json") + long_query = kwargs.pop("long_query", _params.pop("longQuery", 10000000000)) # type: int + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/long/10000000000" # Construct parameters - _params['longQuery'] = _SERIALIZER.query("long_query", long_query, 'int') + _params["longQuery"] = _SERIALIZER.query("long_query", long_query, "int") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_negative_ten_billion_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_negative_ten_billion_request(**kwargs: Any) -> HttpRequest: """Get '-10000000000' 64 bit integer value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -333,31 +264,22 @@ def build_get_negative_ten_billion_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - long_query = kwargs.pop('long_query', _params.pop('longQuery', -10000000000)) # type: int - accept = _headers.pop('Accept', "application/json") + long_query = kwargs.pop("long_query", _params.pop("longQuery", -10000000000)) # type: int + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/long/-10000000000" # Construct parameters - _params['longQuery'] = _SERIALIZER.query("long_query", long_query, 'int') + _params["longQuery"] = _SERIALIZER.query("long_query", long_query, "int") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_long_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_long_null_request(*, long_query: Optional[int] = None, **kwargs: Any) -> HttpRequest: """Get 'null 64 bit integer value (no query param in uri). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -374,32 +296,22 @@ def build_get_long_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - long_query = kwargs.pop('long_query', _params.pop('longQuery', None)) # type: Optional[int] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/long/null" # Construct parameters if long_query is not None: - _params['longQuery'] = _SERIALIZER.query("long_query", long_query, 'int') + _params["longQuery"] = _SERIALIZER.query("long_query", long_query, "int") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_float_scientific_positive_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_float_scientific_positive_request(**kwargs: Any) -> HttpRequest: """Get '1.034E+20' numeric value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -417,31 +329,22 @@ def build_float_scientific_positive_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - float_query = kwargs.pop('float_query', _params.pop('floatQuery', 103400000000000000000)) # type: float - accept = _headers.pop('Accept', "application/json") + float_query = kwargs.pop("float_query", _params.pop("floatQuery", 103400000000000000000)) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/float/1.034E+20" # Construct parameters - _params['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') + _params["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_float_scientific_negative_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_float_scientific_negative_request(**kwargs: Any) -> HttpRequest: """Get '-1.034E-20' numeric value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -459,31 +362,22 @@ def build_float_scientific_negative_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - float_query = kwargs.pop('float_query', _params.pop('floatQuery', -1.034e-20)) # type: float - accept = _headers.pop('Accept', "application/json") + float_query = kwargs.pop("float_query", _params.pop("floatQuery", -1.034e-20)) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/float/-1.034E-20" # Construct parameters - _params['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') + _params["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_float_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_float_null_request(*, float_query: Optional[float] = None, **kwargs: Any) -> HttpRequest: """Get null numeric value (no query parameter). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -500,32 +394,22 @@ def build_float_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - float_query = kwargs.pop('float_query', _params.pop('floatQuery', None)) # type: Optional[float] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/float/null" # Construct parameters if float_query is not None: - _params['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') + _params["floatQuery"] = _SERIALIZER.query("float_query", float_query, "float") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_double_decimal_positive_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_double_decimal_positive_request(**kwargs: Any) -> HttpRequest: """Get '9999999.999' numeric value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -543,31 +427,22 @@ def build_double_decimal_positive_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - double_query = kwargs.pop('double_query', _params.pop('doubleQuery', 9999999.999)) # type: float - accept = _headers.pop('Accept', "application/json") + double_query = kwargs.pop("double_query", _params.pop("doubleQuery", 9999999.999)) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/double/9999999.999" # Construct parameters - _params['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') + _params["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_double_decimal_negative_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_double_decimal_negative_request(**kwargs: Any) -> HttpRequest: """Get '-9999999.999' numeric value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -585,31 +460,22 @@ def build_double_decimal_negative_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - double_query = kwargs.pop('double_query', _params.pop('doubleQuery', -9999999.999)) # type: float - accept = _headers.pop('Accept', "application/json") + double_query = kwargs.pop("double_query", _params.pop("doubleQuery", -9999999.999)) # type: float + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/double/-9999999.999" # Construct parameters - _params['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') + _params["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_double_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_double_null_request(*, double_query: Optional[float] = None, **kwargs: Any) -> HttpRequest: """Get null numeric value (no query parameter). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -626,32 +492,22 @@ def build_double_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - double_query = kwargs.pop('double_query', _params.pop('doubleQuery', None)) # type: Optional[float] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/double/null" # Construct parameters if double_query is not None: - _params['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') + _params["doubleQuery"] = _SERIALIZER.query("double_query", double_query, "float") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_string_unicode_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_unicode_request(**kwargs: Any) -> HttpRequest: """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -669,31 +525,22 @@ def build_string_unicode_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - string_query = kwargs.pop('string_query', _params.pop('stringQuery', "啊齄丂狛狜隣郎隣兀﨩")) # type: str - accept = _headers.pop('Accept', "application/json") + string_query = kwargs.pop("string_query", _params.pop("stringQuery", "啊齄丂狛狜隣郎隣兀﨩")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/string/unicode/" # Construct parameters - _params['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') + _params["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_string_url_encoded_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_url_encoded_request(**kwargs: Any) -> HttpRequest: """Get 'begin!*'();:@ &=+$,/?#[]end. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -712,31 +559,22 @@ def build_string_url_encoded_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - string_query = kwargs.pop('string_query', _params.pop('stringQuery', "begin!*'();:@ &=+$,/?#[]end")) # type: str - accept = _headers.pop('Accept', "application/json") + string_query = kwargs.pop("string_query", _params.pop("stringQuery", "begin!*'();:@ &=+$,/?#[]end")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend" # Construct parameters - _params['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') + _params["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_string_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_empty_request(**kwargs: Any) -> HttpRequest: """Get ''. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -754,31 +592,22 @@ def build_string_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - string_query = kwargs.pop('string_query', _params.pop('stringQuery', "")) # type: str - accept = _headers.pop('Accept', "application/json") + string_query = kwargs.pop("string_query", _params.pop("stringQuery", "")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/string/empty" # Construct parameters - _params['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') + _params["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_string_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_string_null_request(*, string_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get null (no query parameter in url). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -795,32 +624,22 @@ def build_string_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - string_query = kwargs.pop('string_query', _params.pop('stringQuery', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/string/null" # Construct parameters if string_query is not None: - _params['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') + _params["stringQuery"] = _SERIALIZER.query("string_query", string_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_enum_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_enum_valid_request(*, enum_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get using uri with query parameter 'green color'. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -838,32 +657,22 @@ def build_enum_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - enum_query = kwargs.pop('enum_query', _params.pop('enumQuery', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/enum/green%20color" # Construct parameters if enum_query is not None: - _params['enumQuery'] = _SERIALIZER.query("enum_query", enum_query, 'str') + _params["enumQuery"] = _SERIALIZER.query("enum_query", enum_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_enum_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_enum_null_request(*, enum_query: Optional[str] = None, **kwargs: Any) -> HttpRequest: """Get null (no query parameter in url). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -881,32 +690,22 @@ def build_enum_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - enum_query = kwargs.pop('enum_query', _params.pop('enumQuery', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/enum/null" # Construct parameters if enum_query is not None: - _params['enumQuery'] = _SERIALIZER.query("enum_query", enum_query, 'str') + _params["enumQuery"] = _SERIALIZER.query("enum_query", enum_query, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_byte_multi_byte_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_byte_multi_byte_request(*, byte_query: Optional[bytes] = None, **kwargs: Any) -> HttpRequest: """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -924,32 +723,22 @@ def build_byte_multi_byte_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - byte_query = kwargs.pop('byte_query', _params.pop('byteQuery', None)) # type: Optional[bytes] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/byte/multibyte" # Construct parameters if byte_query is not None: - _params['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') + _params["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_byte_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_byte_empty_request(**kwargs: Any) -> HttpRequest: """Get '' as byte array. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -967,31 +756,22 @@ def build_byte_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - byte_query = kwargs.pop('byte_query', _params.pop('byteQuery', bytes("", encoding="utf-8"))) # type: bytes - accept = _headers.pop('Accept', "application/json") + byte_query = kwargs.pop("byte_query", _params.pop("byteQuery", bytes("", encoding="utf-8"))) # type: bytes + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/byte/empty" # Construct parameters - _params['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') + _params["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_byte_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_byte_null_request(*, byte_query: Optional[bytes] = None, **kwargs: Any) -> HttpRequest: """Get null as byte array (no query parameters in uri). See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1008,32 +788,22 @@ def build_byte_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - byte_query = kwargs.pop('byte_query', _params.pop('byteQuery', None)) # type: Optional[bytes] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/byte/null" # Construct parameters if byte_query is not None: - _params['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') + _params["byteQuery"] = _SERIALIZER.query("byte_query", byte_query, "bytearray") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_date_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_date_valid_request(**kwargs: Any) -> HttpRequest: """Get '2012-01-01' as date. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1051,31 +821,22 @@ def build_date_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - date_query = kwargs.pop('date_query', _params.pop('dateQuery', "2012-01-01")) # type: datetime.date - accept = _headers.pop('Accept', "application/json") + date_query = kwargs.pop("date_query", _params.pop("dateQuery", "2012-01-01")) # type: datetime.date + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/date/2012-01-01" # Construct parameters - _params['dateQuery'] = _SERIALIZER.query("date_query", date_query, 'date') + _params["dateQuery"] = _SERIALIZER.query("date_query", date_query, "date") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_date_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_date_null_request(*, date_query: Optional[datetime.date] = None, **kwargs: Any) -> HttpRequest: """Get null as date - this should result in no query parameters in uri. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1092,32 +853,22 @@ def build_date_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - date_query = kwargs.pop('date_query', _params.pop('dateQuery', None)) # type: Optional[datetime.date] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/date/null" # Construct parameters if date_query is not None: - _params['dateQuery'] = _SERIALIZER.query("date_query", date_query, 'date') + _params["dateQuery"] = _SERIALIZER.query("date_query", date_query, "date") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_date_time_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_date_time_valid_request(**kwargs: Any) -> HttpRequest: """Get '2012-01-01T01:01:01Z' as date-time. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1136,31 +887,24 @@ def build_date_time_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - date_time_query = kwargs.pop('date_time_query', _params.pop('dateTimeQuery', "2012-01-01T01:01:01Z")) # type: datetime.datetime - accept = _headers.pop('Accept', "application/json") + date_time_query = kwargs.pop( + "date_time_query", _params.pop("dateTimeQuery", "2012-01-01T01:01:01Z") + ) # type: datetime.datetime + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/datetime/2012-01-01T01%3A01%3A01Z" # Construct parameters - _params['dateTimeQuery'] = _SERIALIZER.query("date_time_query", date_time_query, 'iso-8601') + _params["dateTimeQuery"] = _SERIALIZER.query("date_time_query", date_time_query, "iso-8601") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_date_time_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_date_time_null_request(*, date_time_query: Optional[datetime.datetime] = None, **kwargs: Any) -> HttpRequest: """Get null as date-time, should result in no query parameters in uri. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1177,32 +921,22 @@ def build_date_time_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - date_time_query = kwargs.pop('date_time_query', _params.pop('dateTimeQuery', None)) # type: Optional[datetime.datetime] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/datetime/null" # Construct parameters if date_time_query is not None: - _params['dateTimeQuery'] = _SERIALIZER.query("date_time_query", date_time_query, 'iso-8601') + _params["dateTimeQuery"] = _SERIALIZER.query("date_time_query", date_time_query, "iso-8601") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_array_string_csv_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_csv_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the csv-array format. @@ -1221,32 +955,22 @@ def build_array_string_csv_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/csv/string/valid" # Construct parameters if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') + _params["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_array_string_csv_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_csv_null_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get a null array of string using the csv-array format. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1263,32 +987,22 @@ def build_array_string_csv_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/csv/string/null" # Construct parameters if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') + _params["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_array_string_csv_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_csv_empty_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get an empty array [] of string using the csv-array format. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1306,32 +1020,24 @@ def build_array_string_csv_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/csv/string/empty" # Construct parameters if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') + _params["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_array_string_no_collection_format_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, array_query: Optional[List[str]] = None, **kwargs: Any +) -> HttpRequest: """Array query has no defined collection format, should default to csv. Pass in ['hello', 'nihao', 'bonjour'] for the 'arrayQuery' parameter to the service. @@ -1350,32 +1056,22 @@ def build_array_string_no_collection_format_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/none/string/empty" # Construct parameters if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') + _params["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=",") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_array_string_ssv_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_ssv_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the ssv-array format. @@ -1394,32 +1090,22 @@ def build_array_string_ssv_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/ssv/string/valid" # Construct parameters if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=' ') + _params["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=" ") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_array_string_tsv_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_tsv_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the tsv-array format. @@ -1438,32 +1124,22 @@ def build_array_string_tsv_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/tsv/string/valid" # Construct parameters if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=' ') + _params["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div=" ") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_array_string_pipes_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_pipes_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the pipes-array format. @@ -1482,23 +1158,16 @@ def build_array_string_pipes_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/pipes/string/valid" # Construct parameters if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div='|') + _params["arrayQuery"] = _SERIALIZER.query("array_query", array_query, "[str]", div="|") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders_py3.py deleted file mode 100644 index 03f28fcb3a2..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlLowLevel/urllowlevel/rest/queries/_request_builders_py3.py +++ /dev/null @@ -1,1488 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, List, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_boolean_true_request( - **kwargs: Any -) -> HttpRequest: - """Get true Boolean value on path. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword bool_query: true boolean value. Default value is True. Note that overriding this - default value may result in unsupported behavior. - :paramtype bool_query: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - bool_query = kwargs.pop('bool_query', _params.pop('boolQuery', True)) # type: bool - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/bool/true" - - # Construct parameters - _params['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_false_request( - **kwargs: Any -) -> HttpRequest: - """Get false Boolean value on path. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword bool_query: false boolean value. Required. Default value is False. Note that - overriding this default value may result in unsupported behavior. - :paramtype bool_query: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - bool_query = kwargs.pop('bool_query', _params.pop('boolQuery', False)) # type: bool - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/bool/false" - - # Construct parameters - _params['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_boolean_null_request( - *, - bool_query: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - """Get null Boolean value on query (query string should be absent). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword bool_query: null boolean value. Default value is None. - :paramtype bool_query: bool - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/bool/null" - - # Construct parameters - if bool_query is not None: - _params['boolQuery'] = _SERIALIZER.query("bool_query", bool_query, 'bool') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_int_one_million_request( - **kwargs: Any -) -> HttpRequest: - """Get '1000000' integer value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword int_query: '1000000' integer value. Default value is 1000000. Note that overriding - this default value may result in unsupported behavior. - :paramtype int_query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - int_query = kwargs.pop('int_query', _params.pop('intQuery', 1000000)) # type: int - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/int/1000000" - - # Construct parameters - _params['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_int_negative_one_million_request( - **kwargs: Any -) -> HttpRequest: - """Get '-1000000' integer value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword int_query: '-1000000' integer value. Default value is -1000000. Note that overriding - this default value may result in unsupported behavior. - :paramtype int_query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - int_query = kwargs.pop('int_query', _params.pop('intQuery', -1000000)) # type: int - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/int/-1000000" - - # Construct parameters - _params['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_int_null_request( - *, - int_query: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - """Get null integer value (no query parameter). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword int_query: null integer value. Default value is None. - :paramtype int_query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/int/null" - - # Construct parameters - if int_query is not None: - _params['intQuery'] = _SERIALIZER.query("int_query", int_query, 'int') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_ten_billion_request( - **kwargs: Any -) -> HttpRequest: - """Get '10000000000' 64 bit integer value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword long_query: '10000000000' 64 bit integer value. Default value is 10000000000. Note - that overriding this default value may result in unsupported behavior. - :paramtype long_query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - long_query = kwargs.pop('long_query', _params.pop('longQuery', 10000000000)) # type: int - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/long/10000000000" - - # Construct parameters - _params['longQuery'] = _SERIALIZER.query("long_query", long_query, 'int') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_negative_ten_billion_request( - **kwargs: Any -) -> HttpRequest: - """Get '-10000000000' 64 bit integer value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword long_query: '-10000000000' 64 bit integer value. Default value is -10000000000. Note - that overriding this default value may result in unsupported behavior. - :paramtype long_query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - long_query = kwargs.pop('long_query', _params.pop('longQuery', -10000000000)) # type: int - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/long/-10000000000" - - # Construct parameters - _params['longQuery'] = _SERIALIZER.query("long_query", long_query, 'int') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_long_null_request( - *, - long_query: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - """Get 'null 64 bit integer value (no query param in uri). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword long_query: null 64 bit integer value. Default value is None. - :paramtype long_query: int - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/long/null" - - # Construct parameters - if long_query is not None: - _params['longQuery'] = _SERIALIZER.query("long_query", long_query, 'int') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_float_scientific_positive_request( - **kwargs: Any -) -> HttpRequest: - """Get '1.034E+20' numeric value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword float_query: '1.034E+20'numeric value. Default value is 103400000000000000000. Note - that overriding this default value may result in unsupported behavior. - :paramtype float_query: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - float_query = kwargs.pop('float_query', _params.pop('floatQuery', 103400000000000000000)) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/float/1.034E+20" - - # Construct parameters - _params['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_float_scientific_negative_request( - **kwargs: Any -) -> HttpRequest: - """Get '-1.034E-20' numeric value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword float_query: '-1.034E-20'numeric value. Default value is -1.034e-20. Note that - overriding this default value may result in unsupported behavior. - :paramtype float_query: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - float_query = kwargs.pop('float_query', _params.pop('floatQuery', -1.034e-20)) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/float/-1.034E-20" - - # Construct parameters - _params['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_float_null_request( - *, - float_query: Optional[float] = None, - **kwargs: Any -) -> HttpRequest: - """Get null numeric value (no query parameter). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword float_query: null numeric value. Default value is None. - :paramtype float_query: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/float/null" - - # Construct parameters - if float_query is not None: - _params['floatQuery'] = _SERIALIZER.query("float_query", float_query, 'float') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_double_decimal_positive_request( - **kwargs: Any -) -> HttpRequest: - """Get '9999999.999' numeric value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword double_query: '9999999.999'numeric value. Default value is 9999999.999. Note that - overriding this default value may result in unsupported behavior. - :paramtype double_query: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - double_query = kwargs.pop('double_query', _params.pop('doubleQuery', 9999999.999)) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/double/9999999.999" - - # Construct parameters - _params['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_double_decimal_negative_request( - **kwargs: Any -) -> HttpRequest: - """Get '-9999999.999' numeric value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword double_query: '-9999999.999'numeric value. Default value is -9999999.999. Note that - overriding this default value may result in unsupported behavior. - :paramtype double_query: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - double_query = kwargs.pop('double_query', _params.pop('doubleQuery', -9999999.999)) # type: float - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/double/-9999999.999" - - # Construct parameters - _params['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_double_null_request( - *, - double_query: Optional[float] = None, - **kwargs: Any -) -> HttpRequest: - """Get null numeric value (no query parameter). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword double_query: null numeric value. Default value is None. - :paramtype double_query: float - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/double/null" - - # Construct parameters - if double_query is not None: - _params['doubleQuery'] = _SERIALIZER.query("double_query", double_query, 'float') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_string_unicode_request( - **kwargs: Any -) -> HttpRequest: - """Get '啊齄丂狛狜隣郎隣兀﨩' multi-byte string value. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword string_query: '啊齄丂狛狜隣郎隣兀﨩'multi-byte string value. Default value is "啊齄丂狛狜隣郎隣兀﨩". Note - that overriding this default value may result in unsupported behavior. - :paramtype string_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - string_query = kwargs.pop('string_query', _params.pop('stringQuery', "啊齄丂狛狜隣郎隣兀﨩")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/string/unicode/" - - # Construct parameters - _params['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_string_url_encoded_request( - **kwargs: Any -) -> HttpRequest: - """Get 'begin!*'();:@ &=+$,/?#[]end. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword string_query: 'begin!*'();:@ &=+$,/?#[]end' url encoded string value. Default value is - "begin!*'();:@ &=+$,/?#[]end". Note that overriding this default value may result in - unsupported behavior. - :paramtype string_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - string_query = kwargs.pop('string_query', _params.pop('stringQuery', "begin!*'();:@ &=+$,/?#[]end")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/string/begin%21%2A%27%28%29%3B%3A%40%20%26%3D%2B%24%2C%2F%3F%23%5B%5Dend" - - # Construct parameters - _params['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_string_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get ''. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword string_query: '' string value. Required. Default value is "". Note that overriding - this default value may result in unsupported behavior. - :paramtype string_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - string_query = kwargs.pop('string_query', _params.pop('stringQuery', "")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/string/empty" - - # Construct parameters - _params['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_string_null_request( - *, - string_query: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get null (no query parameter in url). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword string_query: null string value. Default value is None. - :paramtype string_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/string/null" - - # Construct parameters - if string_query is not None: - _params['stringQuery'] = _SERIALIZER.query("string_query", string_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_enum_valid_request( - *, - enum_query: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get using uri with query parameter 'green color'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword enum_query: 'green color' enum value. Known values are: "red color", "green color", - and "blue color". Default value is None. - :paramtype enum_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/enum/green%20color" - - # Construct parameters - if enum_query is not None: - _params['enumQuery'] = _SERIALIZER.query("enum_query", enum_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_enum_null_request( - *, - enum_query: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """Get null (no query parameter in url). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword enum_query: null string value. Known values are: "red color", "green color", and "blue - color". Default value is None. - :paramtype enum_query: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/enum/null" - - # Construct parameters - if enum_query is not None: - _params['enumQuery'] = _SERIALIZER.query("enum_query", enum_query, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_byte_multi_byte_request( - *, - byte_query: Optional[bytes] = None, - **kwargs: Any -) -> HttpRequest: - """Get '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword byte_query: '啊齄丂狛狜隣郎隣兀﨩' multibyte value as utf-8 encoded byte array. Default value is - None. - :paramtype byte_query: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/byte/multibyte" - - # Construct parameters - if byte_query is not None: - _params['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_byte_empty_request( - **kwargs: Any -) -> HttpRequest: - """Get '' as byte array. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword byte_query: '' as byte array. Required. Default value is bytes("", encoding="utf-8"). - Note that overriding this default value may result in unsupported behavior. - :paramtype byte_query: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - byte_query = kwargs.pop('byte_query', _params.pop('byteQuery', bytes("", encoding="utf-8"))) # type: bytes - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/byte/empty" - - # Construct parameters - _params['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_byte_null_request( - *, - byte_query: Optional[bytes] = None, - **kwargs: Any -) -> HttpRequest: - """Get null as byte array (no query parameters in uri). - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword byte_query: null as byte array (no query parameters in uri). Default value is None. - :paramtype byte_query: bytes - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/byte/null" - - # Construct parameters - if byte_query is not None: - _params['byteQuery'] = _SERIALIZER.query("byte_query", byte_query, 'bytearray') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_date_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get '2012-01-01' as date. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword date_query: '2012-01-01' as date. Default value is "2012-01-01". Note that overriding - this default value may result in unsupported behavior. - :paramtype date_query: ~datetime.date - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - date_query = kwargs.pop('date_query', _params.pop('dateQuery', "2012-01-01")) # type: datetime.date - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/date/2012-01-01" - - # Construct parameters - _params['dateQuery'] = _SERIALIZER.query("date_query", date_query, 'date') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_date_null_request( - *, - date_query: Optional[datetime.date] = None, - **kwargs: Any -) -> HttpRequest: - """Get null as date - this should result in no query parameters in uri. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword date_query: null as date (no query parameters in uri). Default value is None. - :paramtype date_query: ~datetime.date - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/date/null" - - # Construct parameters - if date_query is not None: - _params['dateQuery'] = _SERIALIZER.query("date_query", date_query, 'date') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_date_time_valid_request( - **kwargs: Any -) -> HttpRequest: - """Get '2012-01-01T01:01:01Z' as date-time. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword date_time_query: '2012-01-01T01:01:01Z' as date-time. Default value is - "2012-01-01T01:01:01Z". Note that overriding this default value may result in unsupported - behavior. - :paramtype date_time_query: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - date_time_query = kwargs.pop('date_time_query', _params.pop('dateTimeQuery', "2012-01-01T01:01:01Z")) # type: datetime.datetime - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/datetime/2012-01-01T01%3A01%3A01Z" - - # Construct parameters - _params['dateTimeQuery'] = _SERIALIZER.query("date_time_query", date_time_query, 'iso-8601') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_date_time_null_request( - *, - date_time_query: Optional[datetime.datetime] = None, - **kwargs: Any -) -> HttpRequest: - """Get null as date-time, should result in no query parameters in uri. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword date_time_query: null as date-time (no query parameters). Default value is None. - :paramtype date_time_query: ~datetime.datetime - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/datetime/null" - - # Construct parameters - if date_time_query is not None: - _params['dateTimeQuery'] = _SERIALIZER.query("date_time_query", date_time_query, 'iso-8601') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_csv_valid_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the - csv-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - ''] using the csv-array format. Default value is None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/csv/string/valid" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_csv_null_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get a null array of string using the csv-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: a null array of string using the csv-array format. Default value is None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/csv/string/null" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_csv_empty_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get an empty array [] of string using the csv-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: an empty array [] of string using the csv-array format. Default value is - None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/csv/string/empty" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_no_collection_format_empty_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Array query has no defined collection format, should default to csv. Pass in ['hello', 'nihao', - 'bonjour'] for the 'arrayQuery' parameter to the service. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: Array-typed query parameter. Pass in ['hello', 'nihao', 'bonjour']. - Default value is None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/none/string/empty" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=',') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_ssv_valid_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the - ssv-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - ''] using the ssv-array format. Default value is None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/ssv/string/valid" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=' ') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_tsv_valid_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the - tsv-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - ''] using the tsv-array format. Default value is None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/tsv/string/valid" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div=' ') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_pipes_valid_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the - pipes-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - ''] using the pipes-array format. Default value is None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/pipes/string/valid" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = _SERIALIZER.query("array_query", array_query, '[str]', div='|') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_client.py index 3ff1948b73d..c2795fafff3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-acc """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestUrlMutliCollectionFormatTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/__init__.py index deed18c33fd..eb552e0489b 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_array_string_multi_null_request - from ._request_builders_py3 import build_array_string_multi_empty_request - from ._request_builders_py3 import build_array_string_multi_valid_request -except (SyntaxError, ImportError): - from ._request_builders import build_array_string_multi_null_request # type: ignore - from ._request_builders import build_array_string_multi_empty_request # type: ignore - from ._request_builders import build_array_string_multi_valid_request # type: ignore +from ._request_builders import build_array_string_multi_null_request +from ._request_builders import build_array_string_multi_empty_request +from ._request_builders import build_array_string_multi_valid_request __all__ = [ "build_array_string_multi_null_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders.py index 4e724f940a5..0aa3fe805f3 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders.py @@ -15,12 +15,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_array_string_multi_null_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_multi_null_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get a null array of string using the multi-array format. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -38,32 +34,24 @@ def build_array_string_multi_null_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/multi/string/null" # Construct parameters if array_query is not None: - _params['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] + _params["arrayQuery"] = [ + _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query + ] # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_array_string_multi_empty_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_multi_empty_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get an empty array [] of string using the multi-array format. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -81,32 +69,24 @@ def build_array_string_multi_empty_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/multi/string/empty" # Construct parameters if array_query is not None: - _params['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] + _params["arrayQuery"] = [ + _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query + ] # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_array_string_multi_valid_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_array_string_multi_valid_request(*, array_query: Optional[List[str]] = None, **kwargs: Any) -> HttpRequest: """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the mult-array format. @@ -125,23 +105,18 @@ def build_array_string_multi_valid_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - array_query = kwargs.pop('array_query', _params.pop('arrayQuery', None)) # type: Optional[List[str]] - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/queries/array/multi/string/valid" # Construct parameters if array_query is not None: - _params['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] + _params["arrayQuery"] = [ + _SERIALIZER.query("array_query", q, "str") if q is not None else "" for q in array_query + ] # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders_py3.py deleted file mode 100644 index 60bd5381317..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/UrlMultiCollectionFormatLowLevel/urlmulticollectionformatlowlevel/rest/queries/_request_builders_py3.py +++ /dev/null @@ -1,147 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, List, Optional - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_array_string_multi_null_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get a null array of string using the multi-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: a null array of string using the multi-array format. Default value is - None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/multi/string/null" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_multi_empty_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get an empty array [] of string using the multi-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: an empty array [] of string using the multi-array format. Default value - is None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/multi/string/empty" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_array_string_multi_valid_request( - *, - array_query: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - """Get an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, ''] using the - mult-array format. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword array_query: an array of string ['ArrayQuery1', 'begin!*'();:@ &=+$,/?#[]end' , null, - ''] using the mult-array format. Default value is None. - :paramtype array_query: list[str] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/queries/array/multi/string/valid" - - # Construct parameters - if array_query is not None: - _params['arrayQuery'] = [_SERIALIZER.query("array_query", q, 'str') if q is not None else '' for q in array_query] - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_client.py index efe76d66239..e8d76a38943 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/_client.py @@ -33,7 +33,6 @@ class AutoRestValidationTest: # pylint: disable=client-accepts-api-version-keyw """ def __init__(self, subscription_id: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestValidationTestConfiguration(subscription_id=subscription_id, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/__init__.py index 3d6cfc6b060..4b6477de821 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/__init__.py @@ -6,16 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_validation_of_method_parameters_request - from ._request_builders_py3 import build_validation_of_body_request - from ._request_builders_py3 import build_get_with_constant_in_path_request - from ._request_builders_py3 import build_post_with_constant_in_body_request -except (SyntaxError, ImportError): - from ._request_builders import build_validation_of_method_parameters_request # type: ignore - from ._request_builders import build_validation_of_body_request # type: ignore - from ._request_builders import build_get_with_constant_in_path_request # type: ignore - from ._request_builders import build_post_with_constant_in_body_request # type: ignore +from ._request_builders import build_validation_of_method_parameters_request +from ._request_builders import build_validation_of_body_request +from ._request_builders import build_get_with_constant_in_path_request +from ._request_builders import build_post_with_constant_in_body_request __all__ = [ "build_validation_of_method_parameters_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py index 1dd2e9c8eb8..35e897ebbf0 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders.py @@ -23,15 +23,10 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off def build_validation_of_method_parameters_request( - resource_group_name, # type: str - id, # type: int - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, id: int, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Validates input parameters on the method. See swagger for details. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -53,42 +48,40 @@ def build_validation_of_method_parameters_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('apiVersion', "1.0.0")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("apiVersion", "1.0.0")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/fakepath/{subscriptionId}/{resourceGroupName}/{id}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9\']+'), - "id": _SERIALIZER.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=10, min_length=3, pattern=r"[a-zA-Z0-9\']+" + ), + "id": _SERIALIZER.url("id", id, "int", maximum=1000, minimum=100, multiple=10), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['apiVersion'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["apiVersion"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @overload def build_validation_of_body_request( - resource_group_name, # type: str - id, # type: int - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, + id: int, + subscription_id: str, + *, + content_type: Optional[str] = None, + json: Optional[JSON] = None, + **kwargs: Any +) -> HttpRequest: """Validates body parameters on the method. See swagger for details. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -144,12 +137,14 @@ def build_validation_of_body_request( @overload def build_validation_of_body_request( - resource_group_name, # type: str - id, # type: int - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, + id: int, + subscription_id: str, + *, + content_type: Optional[str] = None, + content: Optional[IO] = None, + **kwargs: Any +) -> HttpRequest: """Validates body parameters on the method. See swagger for details. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -175,12 +170,8 @@ def build_validation_of_body_request( def build_validation_of_body_request( - resource_group_name, # type: str - id, # type: int - subscription_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest + resource_group_name: str, id: int, subscription_id: str, **kwargs: Any +) -> HttpRequest: """Validates body parameters on the method. See swagger for details. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -207,41 +198,34 @@ def build_validation_of_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('apiVersion', "1.0.0")) # type: str - accept = _headers.pop('Accept', "application/json") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version = kwargs.pop("api_version", _params.pop("apiVersion", "1.0.0")) # type: str + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/fakepath/{subscriptionId}/{resourceGroupName}/{id}" path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'), - "id": _SERIALIZER.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=10, min_length=3, pattern=r"[a-zA-Z0-9]+" + ), + "id": _SERIALIZER.url("id", id, "int", maximum=1000, minimum=100, multiple=10), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['apiVersion'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["apiVersion"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_with_constant_in_path_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_with_constant_in_path_request(**kwargs: Any) -> HttpRequest: """get_with_constant_in_path. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -256,27 +240,22 @@ def build_get_with_constant_in_path_request( :rtype: ~azure.core.rest.HttpRequest """ - constant_param = kwargs.pop('constant_param', "constant") # type: str + constant_param = kwargs.pop("constant_param", "constant") # type: str # Construct URL _url = "/validation/constantsInPath/{constantParam}/value" path_format_arguments = { - "constantParam": _SERIALIZER.url("constant_param", constant_param, 'str'), + "constantParam": _SERIALIZER.url("constant_param", constant_param, "str"), } _url = _format_url_section(_url, **path_format_arguments) - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) @overload def build_post_with_constant_in_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, json: Optional[JSON] = None, **kwargs: Any +) -> HttpRequest: """post_with_constant_in_body. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -328,9 +307,8 @@ def build_post_with_constant_in_body_request( @overload def build_post_with_constant_in_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest + *, content_type: Optional[str] = None, content: Optional[IO] = None, **kwargs: Any +) -> HttpRequest: """post_with_constant_in_body. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -351,10 +329,7 @@ def build_post_with_constant_in_body_request( """ -def build_post_with_constant_in_body_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_post_with_constant_in_body_request(**kwargs: Any) -> HttpRequest: """post_with_constant_in_body. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -376,26 +351,21 @@ def build_post_with_constant_in_body_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - constant_param = kwargs.pop('constant_param', "constant") # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + constant_param = kwargs.pop("constant_param", "constant") # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/validation/constantsInPath/{constantParam}/value" path_format_arguments = { - "constantParam": _SERIALIZER.url("constant_param", constant_param, 'str'), + "constantParam": _SERIALIZER.url("constant_param", constant_param, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py deleted file mode 100644 index f57666447f7..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/ValidationLowLevel/validationlowlevel/rest/_request_builders_py3.py +++ /dev/null @@ -1,405 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, Optional, Union, overload - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from .._serialization import Serializer -from .._vendor import _format_url_section - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_validation_of_method_parameters_request( - resource_group_name: str, - id: int, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Validates input parameters on the method. See swagger for details. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. - Required. - :type resource_group_name: str - :param id: Required int multiple of 10 from 100 to 1000. Required. - :type id: int - :param subscription_id: Subscription ID. Required. - :type subscription_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop('api_version', _params.pop('apiVersion', "1.0.0")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/fakepath/{subscriptionId}/{resourceGroupName}/{id}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9\']+'), - "id": _SERIALIZER.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['apiVersion'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -@overload -def build_validation_of_body_request( - resource_group_name: str, - id: int, - subscription_id: str, - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """Validates body parameters on the method. See swagger for details. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. - Required. - :type resource_group_name: str - :param id: Required int multiple of 10 from 100 to 1000. Required. - :type id: int - :param subscription_id: Subscription ID. Required. - :type subscription_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Default value is None. - :paramtype json: JSON - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. - "child": { - "constProperty": "constant", # Default value is "constant". Constant - string. Required. - "count": 0 # Optional. Count. - }, - "constChild": { - "constProperty": "constant", # Default value is "constant". Constant - string. Required. - "constProperty2": "constant2" # Default value is "constant2". - Constant string2. Required. - }, - "constInt": 0, # Default value is 0. Constant int. Required. - "constString": "constant", # Default value is "constant". Constant string. - Required. - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is - "constant_string_as_enum". Constant string as Enum. - "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 - elements. - ], - "image": "str" # Optional. Image URL representing the product. - } - """ - - -@overload -def build_validation_of_body_request( - resource_group_name: str, - id: int, - subscription_id: str, - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """Validates body parameters on the method. See swagger for details. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. - Required. - :type resource_group_name: str - :param id: Required int multiple of 10 from 100 to 1000. Required. - :type id: int - :param subscription_id: Subscription ID. Required. - :type subscription_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Default value is None. - :paramtype content: IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_validation_of_body_request( - resource_group_name: str, - id: int, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - """Validates body parameters on the method. See swagger for details. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param resource_group_name: Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. - Required. - :type resource_group_name: str - :param id: Required int multiple of 10 from 100 to 1000. Required. - :type id: int - :param subscription_id: Subscription ID. Required. - :type subscription_id: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - api_version = kwargs.pop('api_version', _params.pop('apiVersion', "1.0.0")) # type: str - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/fakepath/{subscriptionId}/{resourceGroupName}/{id}" - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'), - "id": _SERIALIZER.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params['apiVersion'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_with_constant_in_path_request( - **kwargs: Any -) -> HttpRequest: - """get_with_constant_in_path. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword constant_param: Default value is "constant". Note that overriding this default value - may result in unsupported behavior. - :paramtype constant_param: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - constant_param = kwargs.pop('constant_param', "constant") # type: str - # Construct URL - _url = "/validation/constantsInPath/{constantParam}/value" - path_format_arguments = { - "constantParam": _SERIALIZER.url("constant_param", constant_param, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -@overload -def build_post_with_constant_in_body_request( - *, - content_type: Optional[str] = None, - json: Optional[JSON] = None, - **kwargs: Any -) -> HttpRequest: - """post_with_constant_in_body. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :keyword json: Default value is None. - :paramtype json: JSON - :keyword constant_param: Default value is "constant". Note that overriding this default value - may result in unsupported behavior. - :paramtype constant_param: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "capacity": 0, # Optional. Non required int betwen 0 and 100 exclusive. - "child": { - "constProperty": "constant", # Default value is "constant". Constant - string. Required. - "count": 0 # Optional. Count. - }, - "constChild": { - "constProperty": "constant", # Default value is "constant". Constant - string. Required. - "constProperty2": "constant2" # Default value is "constant2". - Constant string2. Required. - }, - "constInt": 0, # Default value is 0. Constant int. Required. - "constString": "constant", # Default value is "constant". Constant string. - Required. - "constStringAsEnum": "constant_string_as_enum", # Optional. Default value is - "constant_string_as_enum". Constant string as Enum. - "display_names": [ - "str" # Optional. Non required array of unique items from 0 to 6 - elements. - ], - "image": "str" # Optional. Image URL representing the product. - } - """ - - -@overload -def build_post_with_constant_in_body_request( - *, - content_type: Optional[str] = None, - content: Optional[IO] = None, - **kwargs: Any -) -> HttpRequest: - """post_with_constant_in_body. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :keyword content: Default value is None. - :paramtype content: IO - :keyword constant_param: Default value is "constant". Note that overriding this default value - may result in unsupported behavior. - :paramtype constant_param: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_post_with_constant_in_body_request( - **kwargs: Any -) -> HttpRequest: - """post_with_constant_in_body. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword constant_param: Default value is "constant". Note that overriding this default value - may result in unsupported behavior. - :paramtype constant_param: str - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword json: Is either a model type or a IO type. Default value is None. - :paramtype json: JSON or IO - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - constant_param = kwargs.pop('constant_param', "constant") # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/validation/constantsInPath/{constantParam}/value" - path_format_arguments = { - "constantParam": _SERIALIZER.url("constant_param", constant_param, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_client.py index 7ad866d3c8b..eb29d02566f 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/_client.py @@ -28,7 +28,6 @@ class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-versio """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATXMLServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/__init__.py index b64de561abc..01ebc1e433c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/__init__.py @@ -6,76 +6,40 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_complex_type_ref_no_meta_request - from ._request_builders_py3 import build_put_complex_type_ref_no_meta_request - from ._request_builders_py3 import build_get_complex_type_ref_with_meta_request - from ._request_builders_py3 import build_put_complex_type_ref_with_meta_request - from ._request_builders_py3 import build_get_simple_request - from ._request_builders_py3 import build_put_simple_request - from ._request_builders_py3 import build_get_wrapped_lists_request - from ._request_builders_py3 import build_put_wrapped_lists_request - from ._request_builders_py3 import build_get_headers_request - from ._request_builders_py3 import build_get_empty_list_request - from ._request_builders_py3 import build_put_empty_list_request - from ._request_builders_py3 import build_get_empty_wrapped_lists_request - from ._request_builders_py3 import build_put_empty_wrapped_lists_request - from ._request_builders_py3 import build_get_root_list_request - from ._request_builders_py3 import build_put_root_list_request - from ._request_builders_py3 import build_get_root_list_single_item_request - from ._request_builders_py3 import build_put_root_list_single_item_request - from ._request_builders_py3 import build_get_empty_root_list_request - from ._request_builders_py3 import build_put_empty_root_list_request - from ._request_builders_py3 import build_get_empty_child_element_request - from ._request_builders_py3 import build_put_empty_child_element_request - from ._request_builders_py3 import build_list_containers_request - from ._request_builders_py3 import build_get_service_properties_request - from ._request_builders_py3 import build_put_service_properties_request - from ._request_builders_py3 import build_get_acls_request - from ._request_builders_py3 import build_put_acls_request - from ._request_builders_py3 import build_list_blobs_request - from ._request_builders_py3 import build_json_input_request - from ._request_builders_py3 import build_json_output_request - from ._request_builders_py3 import build_get_xms_text_request - from ._request_builders_py3 import build_get_bytes_request - from ._request_builders_py3 import build_put_binary_request - from ._request_builders_py3 import build_get_uri_request - from ._request_builders_py3 import build_put_uri_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_complex_type_ref_no_meta_request # type: ignore - from ._request_builders import build_put_complex_type_ref_no_meta_request # type: ignore - from ._request_builders import build_get_complex_type_ref_with_meta_request # type: ignore - from ._request_builders import build_put_complex_type_ref_with_meta_request # type: ignore - from ._request_builders import build_get_simple_request # type: ignore - from ._request_builders import build_put_simple_request # type: ignore - from ._request_builders import build_get_wrapped_lists_request # type: ignore - from ._request_builders import build_put_wrapped_lists_request # type: ignore - from ._request_builders import build_get_headers_request # type: ignore - from ._request_builders import build_get_empty_list_request # type: ignore - from ._request_builders import build_put_empty_list_request # type: ignore - from ._request_builders import build_get_empty_wrapped_lists_request # type: ignore - from ._request_builders import build_put_empty_wrapped_lists_request # type: ignore - from ._request_builders import build_get_root_list_request # type: ignore - from ._request_builders import build_put_root_list_request # type: ignore - from ._request_builders import build_get_root_list_single_item_request # type: ignore - from ._request_builders import build_put_root_list_single_item_request # type: ignore - from ._request_builders import build_get_empty_root_list_request # type: ignore - from ._request_builders import build_put_empty_root_list_request # type: ignore - from ._request_builders import build_get_empty_child_element_request # type: ignore - from ._request_builders import build_put_empty_child_element_request # type: ignore - from ._request_builders import build_list_containers_request # type: ignore - from ._request_builders import build_get_service_properties_request # type: ignore - from ._request_builders import build_put_service_properties_request # type: ignore - from ._request_builders import build_get_acls_request # type: ignore - from ._request_builders import build_put_acls_request # type: ignore - from ._request_builders import build_list_blobs_request # type: ignore - from ._request_builders import build_json_input_request # type: ignore - from ._request_builders import build_json_output_request # type: ignore - from ._request_builders import build_get_xms_text_request # type: ignore - from ._request_builders import build_get_bytes_request # type: ignore - from ._request_builders import build_put_binary_request # type: ignore - from ._request_builders import build_get_uri_request # type: ignore - from ._request_builders import build_put_uri_request # type: ignore +from ._request_builders import build_get_complex_type_ref_no_meta_request +from ._request_builders import build_put_complex_type_ref_no_meta_request +from ._request_builders import build_get_complex_type_ref_with_meta_request +from ._request_builders import build_put_complex_type_ref_with_meta_request +from ._request_builders import build_get_simple_request +from ._request_builders import build_put_simple_request +from ._request_builders import build_get_wrapped_lists_request +from ._request_builders import build_put_wrapped_lists_request +from ._request_builders import build_get_headers_request +from ._request_builders import build_get_empty_list_request +from ._request_builders import build_put_empty_list_request +from ._request_builders import build_get_empty_wrapped_lists_request +from ._request_builders import build_put_empty_wrapped_lists_request +from ._request_builders import build_get_root_list_request +from ._request_builders import build_put_root_list_request +from ._request_builders import build_get_root_list_single_item_request +from ._request_builders import build_put_root_list_single_item_request +from ._request_builders import build_get_empty_root_list_request +from ._request_builders import build_put_empty_root_list_request +from ._request_builders import build_get_empty_child_element_request +from ._request_builders import build_put_empty_child_element_request +from ._request_builders import build_list_containers_request +from ._request_builders import build_get_service_properties_request +from ._request_builders import build_put_service_properties_request +from ._request_builders import build_get_acls_request +from ._request_builders import build_put_acls_request +from ._request_builders import build_list_blobs_request +from ._request_builders import build_json_input_request +from ._request_builders import build_json_output_request +from ._request_builders import build_get_xms_text_request +from ._request_builders import build_get_bytes_request +from ._request_builders import build_put_binary_request +from ._request_builders import build_get_uri_request +from ._request_builders import build_put_uri_request __all__ = [ "build_get_complex_type_ref_no_meta_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py index 229c0b66b92..86615766b4c 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders.py @@ -23,12 +23,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_complex_type_ref_no_meta_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_type_ref_no_meta_request(**kwargs: Any) -> HttpRequest: """Get a complex type that has a ref to a complex type with no XML node. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -42,26 +38,18 @@ def build_get_complex_type_ref_no_meta_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/complex-type-ref-no-meta" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_complex_type_ref_no_meta_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complex_type_ref_no_meta_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts a complex type that has a ref to a complex type with no XML node. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -88,26 +76,18 @@ def build_put_complex_type_ref_no_meta_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/complex-type-ref-no-meta" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_complex_type_ref_with_meta_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_complex_type_ref_with_meta_request(**kwargs: Any) -> HttpRequest: """Get a complex type that has a ref to a complex type with XML node. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -121,26 +101,18 @@ def build_get_complex_type_ref_with_meta_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/complex-type-ref-with-meta" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_complex_type_ref_with_meta_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_complex_type_ref_with_meta_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts a complex type that has a ref to a complex type with XML node. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -167,26 +139,18 @@ def build_put_complex_type_ref_with_meta_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/complex-type-ref-with-meta" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_simple_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_simple_request(**kwargs: Any) -> HttpRequest: """Get a simple XML document. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -200,26 +164,18 @@ def build_get_simple_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/simple" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_simple_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_simple_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Put a simple XML document. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -254,29 +210,21 @@ def build_put_simple_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/xml") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/simple" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_wrapped_lists_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_wrapped_lists_request(**kwargs: Any) -> HttpRequest: """Get an XML document with multiple wrapped lists. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -290,26 +238,18 @@ def build_get_wrapped_lists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/wrapped-lists" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_wrapped_lists_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_wrapped_lists_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Put an XML document with multiple wrapped lists. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -338,29 +278,21 @@ def build_put_wrapped_lists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/xml") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/wrapped-lists" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_headers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_headers_request(**kwargs: Any) -> HttpRequest: """Get strongly-typed response headers. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -375,17 +307,10 @@ def build_get_headers_request( # Construct URL _url = "/xml/headers" - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) + return HttpRequest(method="GET", url=_url, **kwargs) -def build_get_empty_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_list_request(**kwargs: Any) -> HttpRequest: """Get an empty list. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -399,26 +324,18 @@ def build_get_empty_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/empty-list" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_empty_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts an empty list. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -453,26 +370,18 @@ def build_put_empty_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/empty-list" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_empty_wrapped_lists_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_wrapped_lists_request(**kwargs: Any) -> HttpRequest: """Gets some empty wrapped lists. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -486,26 +395,18 @@ def build_get_empty_wrapped_lists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/empty-wrapped-lists" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_empty_wrapped_lists_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_wrapped_lists_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts some empty wrapped lists. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -534,26 +435,18 @@ def build_put_empty_wrapped_lists_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/empty-wrapped-lists" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_root_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_root_list_request(**kwargs: Any) -> HttpRequest: """Gets a list as the root element. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -567,26 +460,18 @@ def build_get_root_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/root-list" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_root_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_root_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts a list as the root element. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -615,26 +500,18 @@ def build_put_root_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/root-list" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_root_list_single_item_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_root_list_single_item_request(**kwargs: Any) -> HttpRequest: """Gets a list with a single item. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -648,26 +525,18 @@ def build_get_root_list_single_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/root-list-single-item" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_root_list_single_item_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_root_list_single_item_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts a list with a single item. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -696,26 +565,18 @@ def build_put_root_list_single_item_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/root-list-single-item" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_empty_root_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_root_list_request(**kwargs: Any) -> HttpRequest: """Gets an empty list as the root element. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -729,26 +590,18 @@ def build_get_empty_root_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/empty-root-list" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_empty_root_list_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_root_list_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts an empty list as the root element. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -777,26 +630,18 @@ def build_put_empty_root_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/empty-root-list" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_empty_child_element_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_empty_child_element_request(**kwargs: Any) -> HttpRequest: """Gets an XML document with an empty child element. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -810,26 +655,18 @@ def build_get_empty_child_element_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/empty-child-element" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_empty_child_element_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_empty_child_element_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts a value with an empty child element. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -856,26 +693,18 @@ def build_put_empty_child_element_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/empty-child-element" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_list_containers_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_list_containers_request(**kwargs: Any) -> HttpRequest: """Lists containers in a storage account. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -893,31 +722,22 @@ def build_list_containers_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop('comp', _params.pop('comp', "list")) # type: str - accept = _headers.pop('Accept', "application/xml") + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/" # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') + _params["comp"] = _SERIALIZER.query("comp", comp, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_service_properties_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_service_properties_request(**kwargs: Any) -> HttpRequest: """Gets storage service properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -938,33 +758,24 @@ def build_get_service_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop('comp', _params.pop('comp', "properties")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "service")) # type: str - accept = _headers.pop('Accept', "application/xml") + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/" # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') + _params["comp"] = _SERIALIZER.query("comp", comp, "str") + _params["restype"] = _SERIALIZER.query("restype", restype, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_put_service_properties_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_service_properties_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts storage service properties. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1071,33 +882,24 @@ def build_put_service_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop('comp', _params.pop('comp', "properties")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "service")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + comp = kwargs.pop("comp", _params.pop("comp", "properties")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "service")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/" # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') + _params["comp"] = _SERIALIZER.query("comp", comp, "str") + _params["restype"] = _SERIALIZER.query("restype", restype, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_get_acls_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_acls_request(**kwargs: Any) -> HttpRequest: """Gets storage ACLs for a container. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1118,33 +920,24 @@ def build_get_acls_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop('comp', _params.pop('comp', "acl")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "container")) # type: str - accept = _headers.pop('Accept', "application/xml") + comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/mycontainer" # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') + _params["comp"] = _SERIALIZER.query("comp", comp, "str") + _params["restype"] = _SERIALIZER.query("restype", restype, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_put_acls_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_acls_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Puts storage ACLs for a container. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1185,33 +978,24 @@ def build_put_acls_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop('comp', _params.pop('comp', "acl")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "container")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + comp = kwargs.pop("comp", _params.pop("comp", "acl")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/mycontainer" # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') + _params["comp"] = _SERIALIZER.query("comp", comp, "str") + _params["restype"] = _SERIALIZER.query("restype", restype, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_list_blobs_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_list_blobs_request(**kwargs: Any) -> HttpRequest: """Lists blobs in a storage container. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1232,34 +1016,25 @@ def build_list_blobs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - comp = kwargs.pop('comp', _params.pop('comp', "list")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "container")) # type: str - accept = _headers.pop('Accept', "application/xml") + comp = kwargs.pop("comp", _params.pop("comp", "list")) # type: str + restype = kwargs.pop("restype", _params.pop("restype", "container")) # type: str + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/mycontainer" # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') + _params["comp"] = _SERIALIZER.query("comp", comp, "str") + _params["restype"] = _SERIALIZER.query("restype", restype, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @overload -def build_json_input_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_json_input_request(*, json: JSON, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. @@ -1287,10 +1062,7 @@ def build_json_input_request( @overload -def build_json_input_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_json_input_request(*, content: IO, content_type: Optional[str] = None, **kwargs: Any) -> HttpRequest: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. @@ -1309,10 +1081,7 @@ def build_json_input_request( """ -def build_json_input_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_json_input_request(**kwargs: Any) -> HttpRequest: """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID number 42. @@ -1332,26 +1101,18 @@ def build_json_input_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] # Construct URL _url = "/xml/jsoninput" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) -def build_json_output_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_json_output_request(**kwargs: Any) -> HttpRequest: """A Swagger with XML that has one operation that returns JSON. ID number 42. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1365,26 +1126,18 @@ def build_json_output_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/xml/jsonoutput" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_xms_text_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_xms_text_request(**kwargs: Any) -> HttpRequest: """Get back an XML object with an x-ms-text property, which should translate to the returned object's 'language' property being 'english' and its 'content' property being 'I am text'. @@ -1399,26 +1152,18 @@ def build_get_xms_text_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/x-ms-text" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_get_bytes_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_bytes_request(**kwargs: Any) -> HttpRequest: """Get an XML document with binary property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1432,26 +1177,18 @@ def build_get_bytes_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/bytes" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_binary_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_binary_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Put an XML document with binary property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1475,29 +1212,21 @@ def build_put_binary_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/xml") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/bytes" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) -def build_get_uri_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_uri_request(**kwargs: Any) -> HttpRequest: """Get an XML document with uri property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1511,26 +1240,18 @@ def build_get_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/xml") + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/url" # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_put_uri_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_put_uri_request(*, content: Any, **kwargs: Any) -> HttpRequest: """Put an XML document with uri property. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -1554,20 +1275,15 @@ def build_put_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/xml") + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/xml") # Construct URL _url = "/xml/url" # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, content=content, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py deleted file mode 100644 index e28f4edd7ab..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmlLowLevel/xmlservicelowlevel/rest/xml/_request_builders_py3.py +++ /dev/null @@ -1,1585 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, IO, List, Optional, Union, overload -from xml.etree import ElementTree as ET - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_complex_type_ref_no_meta_request( - **kwargs: Any -) -> HttpRequest: - """Get a complex type that has a ref to a complex type with no XML node. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/complex-type-ref-no-meta" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_complex_type_ref_no_meta_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts a complex type that has a ref to a complex type with no XML node. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "RefToModel": { - "ID": "str" # Optional. The id of the res. - }, - "Something": "str" # Optional. Something else (just to avoid flattening). - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/complex-type-ref-no-meta" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_complex_type_ref_with_meta_request( - **kwargs: Any -) -> HttpRequest: - """Get a complex type that has a ref to a complex type with XML node. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/complex-type-ref-with-meta" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_complex_type_ref_with_meta_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts a complex type that has a ref to a complex type with XML node. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "RefToModel": { - "ID": "str" # Optional. The id of the res. - }, - "Something": "str" # Optional. Something else (just to avoid flattening). - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/complex-type-ref-with-meta" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_simple_request( - **kwargs: Any -) -> HttpRequest: - """Get a simple XML document. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/simple" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_simple_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Put a simple XML document. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "author": "str", # Optional. - "date": "str", # Optional. - "slides": [ - { - "items": [ - "str" # Optional. - ], - "title": "str", # Optional. - "type": "str" # Optional. - } - ], - "title": "str" # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/simple" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_wrapped_lists_request( - **kwargs: Any -) -> HttpRequest: - """Get an XML document with multiple wrapped lists. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/wrapped-lists" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_wrapped_lists_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Put an XML document with multiple wrapped lists. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "BadApples": [ - "str" # Optional. - ], - "GoodApples": [ - "str" # Optional. - ] - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/wrapped-lists" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_headers_request( - **kwargs: Any -) -> HttpRequest: - """Get strongly-typed response headers. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - # Construct URL - _url = "/xml/headers" - - return HttpRequest( - method="GET", - url=_url, - **kwargs - ) - - -def build_get_empty_list_request( - **kwargs: Any -) -> HttpRequest: - """Get an empty list. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/empty-list" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_empty_list_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts an empty list. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "author": "str", # Optional. - "date": "str", # Optional. - "slides": [ - { - "items": [ - "str" # Optional. - ], - "title": "str", # Optional. - "type": "str" # Optional. - } - ], - "title": "str" # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/empty-list" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_empty_wrapped_lists_request( - **kwargs: Any -) -> HttpRequest: - """Gets some empty wrapped lists. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/empty-wrapped-lists" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_empty_wrapped_lists_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts some empty wrapped lists. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "BadApples": [ - "str" # Optional. - ], - "GoodApples": [ - "str" # Optional. - ] - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/empty-wrapped-lists" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_root_list_request( - **kwargs: Any -) -> HttpRequest: - """Gets a list as the root element. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/root-list" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_root_list_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts a list as the root element. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: list[ET.Element] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = [ - { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which - you should reconsider eating this banana. - "flavor": "str", # Optional. - "name": "str" # Optional. - } - ] - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/root-list" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_root_list_single_item_request( - **kwargs: Any -) -> HttpRequest: - """Gets a list with a single item. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/root-list-single-item" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_root_list_single_item_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts a list with a single item. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: list[ET.Element] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = [ - { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which - you should reconsider eating this banana. - "flavor": "str", # Optional. - "name": "str" # Optional. - } - ] - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/root-list-single-item" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_empty_root_list_request( - **kwargs: Any -) -> HttpRequest: - """Gets an empty list as the root element. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/empty-root-list" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_empty_root_list_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts an empty list as the root element. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: list[ET.Element] - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = [ - { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which - you should reconsider eating this banana. - "flavor": "str", # Optional. - "name": "str" # Optional. - } - ] - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/empty-root-list" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_empty_child_element_request( - **kwargs: Any -) -> HttpRequest: - """Gets an XML document with an empty child element. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/empty-child-element" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_empty_child_element_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts a value with an empty child element. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "expiration": "2020-02-20 00:00:00", # Optional. The time at which you - should reconsider eating this banana. - "flavor": "str", # Optional. - "name": "str" # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/empty-child-element" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_list_containers_request( - **kwargs: Any -) -> HttpRequest: - """Lists containers in a storage account. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword comp: Default value is "list". Note that overriding this default value may result in - unsupported behavior. - :paramtype comp: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - comp = kwargs.pop('comp', _params.pop('comp', "list")) # type: str - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/" - - # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_get_service_properties_request( - **kwargs: Any -) -> HttpRequest: - """Gets storage service properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword comp: Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: Default value is "service". Note that overriding this default value may - result in unsupported behavior. - :paramtype restype: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - comp = kwargs.pop('comp', _params.pop('comp', "properties")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "service")) # type: str - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/" - - # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_put_service_properties_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts storage service properties. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :keyword comp: Default value is "properties". Note that overriding this default value may - result in unsupported behavior. - :paramtype comp: str - :keyword restype: Default value is "service". Note that overriding this default value may - result in unsupported behavior. - :paramtype restype: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "Cors": [ - { - "AllowedHeaders": "str", # the request headers that the - origin domain may specify on the CORS request. Required. - "AllowedMethods": "str", # The methods (HTTP request verbs) - that the origin domain may use for a CORS request. (comma separated). - Required. - "AllowedOrigins": "str", # The origin domains that are - permitted to make a request against the storage service via CORS. The - origin domain is the domain from which the request originates. Note that - the origin must be an exact case-sensitive match with the origin that the - user age sends to the service. You can also use the wildcard character - '*' to allow all origin domains to make requests via CORS. Required. - "ExposedHeaders": "str", # The response headers that may be - sent in the response to the CORS request and exposed by the browser to - the request issuer. Required. - "MaxAgeInSeconds": 0 # The maximum amount time that a - browser should cache the preflight OPTIONS request. Required. - } - ], - "DefaultServiceVersion": "str", # Optional. The default version to use for - requests to the Blob service if an incoming request's version is not specified. - Possible values include version 2008-10-27 and all more recent versions. - "DeleteRetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that metrics or - logging or soft-deleted data should be retained. All data older than this - value will be deleted. - "Enabled": bool # Indicates whether a retention policy is enabled - for the storage service. Required. - }, - "HourMetrics": { - "Enabled": bool, # Indicates whether metrics are enabled for the - Blob service. Required. - "IncludeAPIs": bool, # Optional. Indicates whether metrics should - generate summary statistics for called API operations. - "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that - metrics or logging or soft-deleted data should be retained. All data - older than this value will be deleted. - "Enabled": bool # Indicates whether a retention policy is - enabled for the storage service. Required. - }, - "Version": "str" # Optional. The version of Storage Analytics to - configure. - }, - "Logging": { - "Delete": bool, # Indicates whether all delete requests should be - logged. Required. - "Read": bool, # Indicates whether all read requests should be - logged. Required. - "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that - metrics or logging or soft-deleted data should be retained. All data - older than this value will be deleted. - "Enabled": bool # Indicates whether a retention policy is - enabled for the storage service. Required. - }, - "Version": "str", # The version of Storage Analytics to configure. - Required. - "Write": bool # Indicates whether all write requests should be - logged. Required. - }, - "MinuteMetrics": { - "Enabled": bool, # Indicates whether metrics are enabled for the - Blob service. Required. - "IncludeAPIs": bool, # Optional. Indicates whether metrics should - generate summary statistics for called API operations. - "RetentionPolicy": { - "Days": 0, # Optional. Indicates the number of days that - metrics or logging or soft-deleted data should be retained. All data - older than this value will be deleted. - "Enabled": bool # Indicates whether a retention policy is - enabled for the storage service. Required. - }, - "Version": "str" # Optional. The version of Storage Analytics to - configure. - } - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - comp = kwargs.pop('comp', _params.pop('comp', "properties")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "service")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/" - - # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_acls_request( - **kwargs: Any -) -> HttpRequest: - """Gets storage ACLs for a container. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword comp: Default value is "acl". Note that overriding this default value may result in - unsupported behavior. - :paramtype comp: str - :keyword restype: Default value is "container". Note that overriding this default value may - result in unsupported behavior. - :paramtype restype: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - comp = kwargs.pop('comp', _params.pop('comp', "acl")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "container")) # type: str - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/mycontainer" - - # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_put_acls_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Puts storage ACLs for a container. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: list[ET.Element] - :keyword comp: Default value is "acl". Note that overriding this default value may result in - unsupported behavior. - :paramtype comp: str - :keyword restype: Default value is "container". Note that overriding this default value may - result in unsupported behavior. - :paramtype restype: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = [ - { - "AccessPolicy": { - "Expiry": "2020-02-20 00:00:00", # the date-time the policy - expires. Required. - "Permission": "str", # the permissions for the acl policy. - Required. - "Start": "2020-02-20 00:00:00" # the date-time the policy is - active. Required. - }, - "Id": "str" # a unique id. Required. - } - ] - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - comp = kwargs.pop('comp', _params.pop('comp', "acl")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "container")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/mycontainer" - - # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - content=content, - **kwargs - ) - - -def build_list_blobs_request( - **kwargs: Any -) -> HttpRequest: - """Lists blobs in a storage container. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword comp: Default value is "list". Note that overriding this default value may result in - unsupported behavior. - :paramtype comp: str - :keyword restype: Default value is "container". Note that overriding this default value may - result in unsupported behavior. - :paramtype restype: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - comp = kwargs.pop('comp', _params.pop('comp', "list")) # type: str - restype = kwargs.pop('restype', _params.pop('restype', "container")) # type: str - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/mycontainer" - - # Construct parameters - _params['comp'] = _SERIALIZER.query("comp", comp, 'str') - _params['restype'] = _SERIALIZER.query("restype", restype, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -@overload -def build_json_input_request( - *, - json: JSON, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID - number 42. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Required. - :paramtype json: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "id": 0 # Optional. - } - """ - - -@overload -def build_json_input_request( - *, - content: IO, - content_type: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID - number 42. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - -def build_json_input_request( - **kwargs: Any -) -> HttpRequest: - """A Swagger with XML that has one operation that takes JSON as input. You need to send the ID - number 42. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword json: Is either a model type or a IO type. Required. - :paramtype json: JSON or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - # Construct URL - _url = "/xml/jsoninput" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_json_output_request( - **kwargs: Any -) -> HttpRequest: - """A Swagger with XML that has one operation that returns JSON. ID number 42. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/xml/jsonoutput" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_xms_text_request( - **kwargs: Any -) -> HttpRequest: - """Get back an XML object with an x-ms-text property, which should translate to the returned - object's 'language' property being 'english' and its 'content' property being 'I am text'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/x-ms-text" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_get_bytes_request( - **kwargs: Any -) -> HttpRequest: - """Get an XML document with binary property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/bytes" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_binary_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Put an XML document with binary property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "Bytes": bytes("bytes", encoding="utf-8") # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/bytes" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) - - -def build_get_uri_request( - **kwargs: Any -) -> HttpRequest: - """Get an XML document with uri property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/url" - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_put_uri_request( - *, - content: Any, - **kwargs: Any -) -> HttpRequest: - """Put an XML document with uri property. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword content: Required. - :paramtype content: ET.Element - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - content = { - "Url": "str" # Optional. - } - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/xml") - - # Construct URL - _url = "/xml/url" - - # Construct headers - if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - headers=_headers, - content=content, - **kwargs - ) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_client.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_client.py index 1850f75cfff..18a452d252a 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_client.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/_client.py @@ -28,7 +28,6 @@ class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/__init__.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/__init__.py index 108280ab605..0186f6e9219 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/__init__.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/__init__.py @@ -6,14 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._request_builders_py3 import build_get_pet_by_id_request - from ._request_builders_py3 import build_do_something_request - from ._request_builders_py3 import build_has_models_param_request -except (SyntaxError, ImportError): - from ._request_builders import build_get_pet_by_id_request # type: ignore - from ._request_builders import build_do_something_request # type: ignore - from ._request_builders import build_has_models_param_request # type: ignore +from ._request_builders import build_get_pet_by_id_request +from ._request_builders import build_do_something_request +from ._request_builders import build_has_models_param_request __all__ = [ "build_get_pet_by_id_request", diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders.py index 054da7c443e..44ccb98cb58 100644 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders.py +++ b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders.py @@ -16,13 +16,8 @@ _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -# fmt: off -def build_get_pet_by_id_request( - pet_id, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_get_pet_by_id_request(pet_id: str, **kwargs: Any) -> HttpRequest: """Gets pets by id. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -38,32 +33,23 @@ def build_get_pet_by_id_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/errorStatusCodes/Pets/{petId}/GetPet" path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, 'str'), + "petId": _SERIALIZER.url("pet_id", pet_id, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) -def build_do_something_request( - what_action, # type: str - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_do_something_request(what_action: str, **kwargs: Any) -> HttpRequest: """Asks pet to do something. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request @@ -79,31 +65,23 @@ def build_do_something_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/errorStatusCodes/Pets/doSomething/{whatAction}" path_format_arguments = { - "whatAction": _SERIALIZER.url("what_action", what_action, 'str'), + "whatAction": _SERIALIZER.url("what_action", what_action, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) -def build_has_models_param_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest +def build_has_models_param_request(*, models: str = "value1", **kwargs: Any) -> HttpRequest: """Ensure you can correctly deserialize the returned PetActionError and deserialization doesn't conflict with the input param name 'models'. @@ -122,23 +100,16 @@ def build_has_models_param_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - models = kwargs.pop('models', _params.pop('models', "value1")) # type: str - accept = _headers.pop('Accept', "application/json") + accept = _headers.pop("Accept", "application/json") # Construct URL _url = "/errorStatusCodes/Pets/hasModelsParam" # Construct parameters if models is not None: - _params['models'] = _SERIALIZER.query("models", models, 'str') + _params["models"] = _SERIALIZER.query("models", models, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) diff --git a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders_py3.py b/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders_py3.py deleted file mode 100644 index 4c2f2bbd06e..00000000000 --- a/test/vanilla/low-level/Expected/AcceptanceTests/XmsErrorResponseLowLevel/xmserrorresponselowlevel/rest/pet/_request_builders_py3.py +++ /dev/null @@ -1,142 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any - -from azure.core.rest import HttpRequest -from azure.core.utils import case_insensitive_dict - -from ..._serialization import Serializer -from ..._vendor import _format_url_section - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -# fmt: off - -def build_get_pet_by_id_request( - pet_id: str, - **kwargs: Any -) -> HttpRequest: - """Gets pets by id. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param pet_id: pet id. Required. - :type pet_id: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/errorStatusCodes/Pets/{petId}/GetPet" - path_format_arguments = { - "petId": _SERIALIZER.url("pet_id", pet_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_do_something_request( - what_action: str, - **kwargs: Any -) -> HttpRequest: - """Asks pet to do something. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :param what_action: what action the pet should do. Required. - :type what_action: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/errorStatusCodes/Pets/doSomething/{whatAction}" - path_format_arguments = { - "whatAction": _SERIALIZER.url("what_action", what_action, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - headers=_headers, - **kwargs - ) - - -def build_has_models_param_request( - *, - models: str = "value1", - **kwargs: Any -) -> HttpRequest: - """Ensure you can correctly deserialize the returned PetActionError and deserialization doesn't - conflict with the input param name 'models'. - - See https://aka.ms/azsdk/dpcodegen/python/send_request for how to incorporate this request - builder into your code flow. - - :keyword models: Make sure model deserialization doesn't conflict with this param name, which - has input name 'models'. Use client default value in call. Default value is "value1". - :paramtype models: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/dpcodegen/python/send_request for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - """ - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - accept = _headers.pop('Accept', "application/json") - - # Construct URL - _url = "/errorStatusCodes/Pets/hasModelsParam" - - # Construct parameters - if models is not None: - _params['models'] = _SERIALIZER.query("models", models, 'str') - - # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py index 67ed3af2a9c..27155e924da 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py @@ -31,7 +31,6 @@ class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AdditionalPropertiesClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py index 309cf526de3..1e784d47171 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py @@ -30,7 +30,6 @@ class AnythingClient(AnythingClientOperationsMixin): # pylint: disable=client-a """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AnythingClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py index 8820b4cd3da..375f02134f9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-vers """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py index 07f3d37c276..a948d6c23ac 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py @@ -31,7 +31,6 @@ class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-ap """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = BinaryWithContentTypeApplicationJsonConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py index 6022170c0b0..14722e4b578 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-key """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestBoolTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py index a5d96da5507..5c9bcc3e8c8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-versi """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATByteServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py index c2f48b50406..b7247359c24 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py @@ -61,7 +61,6 @@ class AutoRestComplexTestService: # pylint: disable=client-accepts-api-version- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestComplexTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py index 13c79324436..46a75c6f5a9 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py @@ -32,7 +32,6 @@ class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestRFC1123DateTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py index 0d1e3e21d48..6d269d985da 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestDateTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py index 08d9a76f3b2..f4d550f34ef 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-key """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestDateTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py index d0129079fbd..59e2249db46 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATDictionaryServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py index 26cd0601acb..c7a5fa23cd6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestDurationTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py index 511dfe7075d..ba8ca749397 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-versi """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATFileServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py index 7cca8d03649..db177cce584 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-v """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATFormDataServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py index 643510afd14..e0d54b6929a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py @@ -32,7 +32,6 @@ class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-key """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = BodyFormsDataURLEncodedConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py index bdb840bf667..451215eae4f 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestIntegerTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py index 569eff19f5b..627a0ce6eec 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-k """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestNumberTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py index ab01692c075..43a69d47d12 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py @@ -33,7 +33,6 @@ class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-k """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py index 7c3a46c6b92..883d6ecc7b7 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-key """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestTimeTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py index 43f18929abb..055fbbaeb56 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py @@ -43,7 +43,6 @@ class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-vers """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerConstantServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py index 5790b3b1031..42ca7354cd4 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py @@ -29,7 +29,6 @@ class ErrorWithSecrets(ErrorWithSecretsOperationsMixin): # pylint: disable=clie """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = ErrorWithSecretsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py index d2bfd830a4e..bac64fb448c 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py @@ -31,7 +31,6 @@ class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = PetStoreIncConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py index a393f182f22..1714f3c12e8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-ver """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATHeaderServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py index f81d2bd93ec..9a95c6a2963 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py @@ -54,7 +54,6 @@ class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-a """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestHttpInfrastructureTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py index 22abde7132e..2a8c87632b3 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py @@ -32,7 +32,6 @@ class IncorrectReturnedErrorModel( """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = IncorrectReturnedErrorModelConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py index 203eaea903b..5f1ec19e05d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py @@ -29,7 +29,6 @@ class MediaTypesClient(MediaTypesClientOperationsMixin): # pylint: disable=clie """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = MediaTypesClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py index 2850266d61e..4e8926caf7d 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py @@ -29,7 +29,6 @@ class MergePatchJsonClient(MergePatchJsonClientOperationsMixin): # pylint: disa """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = MergePatchJsonClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py index 4991b46543c..0c90d77a59a 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestResourceFlatteningTestService( """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestResourceFlatteningTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py index 348f13419ee..7368662bfb6 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py @@ -31,7 +31,6 @@ class MultipleInheritanceServiceClient( """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py index 125e6061391..7b4671573e5 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py @@ -33,7 +33,6 @@ class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keywor """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = NonStringEnumsClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py index e0da156b1b0..75120ca3163 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py @@ -29,7 +29,6 @@ class ObjectTypeClient(ObjectTypeClientOperationsMixin): # pylint: disable=clie """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = ObjectTypeClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py index 38b0680bab5..316eb823078 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py @@ -32,7 +32,6 @@ class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestParameterFlatteningConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py index d4f53308640..a586afe1934 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py @@ -29,7 +29,6 @@ class AutoRestReportService(AutoRestReportServiceOperationsMixin): # pylint: di """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestReportServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py index ae239d4bfe9..5a1fcedbbae 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py @@ -47,7 +47,6 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestRequiredOptionalTestServiceConfiguration( required_global_path=required_global_path, required_global_query=required_global_query, diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py index 866626263a7..4acceeda321 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py @@ -32,7 +32,6 @@ class ReservedWordsClient(ReservedWordsClientOperationsMixin): # pylint: disabl def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: super().__init__() - self._config = ReservedWordsClientConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py index a74832d7994..cb140873559 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py @@ -35,7 +35,6 @@ class AutorestSecurityAad(AutorestSecurityAadOperationsMixin): # pylint: disabl def __init__( self, credential: "TokenCredential", *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutorestSecurityAadConfiguration(credential=credential, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py index e47d726d05f..6d680c34948 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py @@ -34,7 +34,6 @@ class AutorestSecurityKey(AutorestSecurityKeyOperationsMixin): # pylint: disabl def __init__( self, credential: AzureKeyCredential, *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutorestSecurityKeyConfiguration(credential=credential, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py index 7ff0ace592a..21d09364802 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-acc """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestUrlMutliCollectionFormatTestServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py index 336b2f806a1..41c3ded0dce 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py @@ -47,7 +47,6 @@ def __init__( endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = AutoRestUrlTestServiceConfiguration( global_string_path=global_string_path, global_string_query=global_string_query, **kwargs ) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py index 99441d48199..91485d07175 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py @@ -36,7 +36,6 @@ class AutoRestValidationTest( """ def __init__(self, subscription_id: str, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestValidationTestConfiguration(subscription_id=subscription_id, **kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py index a61c8d60390..cf1339f74b8 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py @@ -31,7 +31,6 @@ class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-versio """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATXMLServiceConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) diff --git a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py index 262d678d363..e4023a22c41 100644 --- a/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py +++ b/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py @@ -31,7 +31,6 @@ class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version- """ def __init__(self, *, endpoint: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = XMSErrorResponseExtensionsConfiguration(**kwargs) self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs) From 8d6aafd66bc4ad4612cadf06179151e730128c88 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 10 Jun 2022 15:35:07 -0700 Subject: [PATCH 2/6] remove reformat next link --- autorest/codegen/__init__.py | 15 ++++++--------- .../codegen/serializers/builder_serializer.py | 1 - tasks.py | 2 -- .../aio/operations/_paging_operations.py | 1 - .../operations/_paging_operations.py | 1 - 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/autorest/codegen/__init__.py b/autorest/codegen/__init__.py index 5ee34ce00ca..e3c39551acb 100644 --- a/autorest/codegen/__init__.py +++ b/autorest/codegen/__init__.py @@ -78,12 +78,6 @@ def _validate_code_model_options(options: Dict[str, Any]) -> None: "--package-mode can only be 'mgmtplane' or 'dataplane' or directory which contains template files" ) - if options["reformat_next_link"] and options["version_tolerant"]: - raise ValueError( - "--reformat-next-link can not be true for version tolerant generations. " - "Please remove --reformat-next-link from your call for version tolerant generations." - ) - if options["multiapi"] and options["version_tolerant"]: raise ValueError( "Can not currently generate version tolerant multiapi SDKs. " @@ -200,6 +194,12 @@ def _build_code_model_options(self) -> Dict[str, Any]: "You have passed in --add-python3-operation-files. " "This flag no longer has an effect bc all SDKs are now Python3 only." ) + if self._autorestapi.get_boolean_value("reformat-next-link"): + _LOGGER.warning( + "You have passed in --reformat-next-link. We have force overriden " + "this to False because we no longer reformat initial query parameters into next " + "calls unless explicitly defined in the service definition." + ) options: Dict[str, Any] = { "azure_arm": azure_arm, @@ -252,9 +252,6 @@ def _build_code_model_options(self) -> Dict[str, Any]: "default-optional-constants-to-none", low_level_client or version_tolerant, ), - "reformat_next_link": self._autorestapi.get_boolean_value( - "reformat-next-link", not version_tolerant - ), } if options["builders_visibility"] is None: diff --git a/autorest/codegen/serializers/builder_serializer.py b/autorest/codegen/serializers/builder_serializer.py index 50783c3bdd7..a1a1837993e 100644 --- a/autorest/codegen/serializers/builder_serializer.py +++ b/autorest/codegen/serializers/builder_serializer.py @@ -815,7 +815,6 @@ def _create_request_builder_call( is_next_request and builder.operation_type == "paging" and not bool(builder.next_request_builder) # type: ignore - and not self.code_model.options["reformat_next_link"] and parameter.location == ParameterLocation.QUERY ): # if we don't want to reformat query parameters for next link calls diff --git a/tasks.py b/tasks.py index cadd13af3cf..7af5d5a4052 100644 --- a/tasks.py +++ b/tasks.py @@ -242,8 +242,6 @@ def _build_flags( namespace += "versiontolerant" else: override_flags["payload-flattening-threshold"] = 1 - override_flags["reformat-next-link"] = False - override_flags["python3-only"] = True # others default to python3 only flags = { "use": AUTOREST_DIR, diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py index 2d0efee159f..1aa8a5d48dc 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py @@ -563,7 +563,6 @@ def prepare_request(next_link=None): else: request = build_duplicate_params_request( - filter=filter, template_url=next_link, headers=_headers, params=_params, diff --git a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py index f8f3bd1a72e..c7a30fa74db 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py @@ -1131,7 +1131,6 @@ def prepare_request(next_link=None): else: request = build_duplicate_params_request( - filter=filter, template_url=next_link, headers=_headers, params=_params, From bd6fa40b72fa011b00b4203933b2066e3d5333ca Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 10 Jun 2022 15:55:46 -0700 Subject: [PATCH 3/6] update changelog --- ChangeLog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 3a6161eb143..bb147a52050 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,12 @@ # Change +### 2022-xx-xx - 6.0.0 + +**Breaking Changes** + +- Only generate Python3 SDKs #1297 +- Don't automatically reformat initial query parameters into the next link #1297 + ### 2022-07-09 - 5.18.0 | Library | Min Version | From 629c2f3bfedda80361fe0b7ce94fa4f7ccb31bd3 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 10 Jun 2022 16:37:28 -0700 Subject: [PATCH 4/6] pylint --- autorest/codegen/serializers/client_serializer.py | 9 +++++---- autorest/codegen/serializers/model_serializer.py | 6 ++++-- autorest/codegen/templates/client.py.jinja2 | 4 ++-- autorest/codegen/templates/config.py.jinja2 | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/autorest/codegen/serializers/client_serializer.py b/autorest/codegen/serializers/client_serializer.py index 44365781c14..d0e2330eaa2 100644 --- a/autorest/codegen/serializers/client_serializer.py +++ b/autorest/codegen/serializers/client_serializer.py @@ -32,7 +32,7 @@ def init_signature_and_response_type_annotation(self, async_mode: bool) -> str: response_type_annotation="None", ) - def pop_kwargs_from_signature(self, async_mode: bool) -> List[str]: + def pop_kwargs_from_signature(self) -> List[str]: return self.parameter_serializer.pop_kwargs_from_signature( self.code_model.client.parameters.kwargs_to_pop, check_kwarg_dict=False, @@ -40,7 +40,8 @@ def pop_kwargs_from_signature(self, async_mode: bool) -> List[str]: pop_params_kwarg=PopKwargType.NO, ) - def class_definition(self, async_mode) -> str: + @property + def class_definition(self) -> str: class_name = self.code_model.client.name has_mixin_og = any(og for og in self.code_model.operation_groups if og.is_mixin) base_class = "" @@ -140,7 +141,7 @@ def serializers_and_operation_groups_properties(self) -> List[str]: ) return retval - def _send_request_signature(self, async_mode: bool) -> str: + def _send_request_signature(self) -> str: send_request_signature = [ "request: HttpRequest," ] + self.code_model.client.parameters.method_signature_kwargs @@ -262,7 +263,7 @@ def init_signature_and_response_type_annotation(self, async_mode: bool) -> str: response_type_annotation="None", ) - def pop_kwargs_from_signature(self, async_mode: bool) -> List[str]: + def pop_kwargs_from_signature(self) -> List[str]: return self.parameter_serializer.pop_kwargs_from_signature( self.code_model.config.parameters.kwargs_to_pop, check_kwarg_dict=False, diff --git a/autorest/codegen/serializers/model_serializer.py b/autorest/codegen/serializers/model_serializer.py index ff15a830477..eabf66ca1dd 100644 --- a/autorest/codegen/serializers/model_serializer.py +++ b/autorest/codegen/serializers/model_serializer.py @@ -116,7 +116,8 @@ def initialize_properties(self, model: ModelType) -> List[str]: init_args.append(f"self.{prop.client_name} = {prop.client_name}") return init_args - def initialize_standard_property(self, prop: Property): + @staticmethod + def initialize_standard_property(prop: Property): if not (prop.optional or prop.client_default_value is not None): return f"{prop.client_name}: {prop.type_annotation()},{prop.pylint_disable}" return ( @@ -146,7 +147,8 @@ def init_line(self, model: ModelType) -> List[str]: return init_properties_declaration - def properties_to_pass_to_super(self, model: ModelType) -> str: + @staticmethod + def properties_to_pass_to_super(model: ModelType) -> str: properties_to_pass_to_super = [] for parent in model.parents: for prop in model.properties: diff --git a/autorest/codegen/templates/client.py.jinja2 b/autorest/codegen/templates/client.py.jinja2 index 11fc9ed92f8..77b99e2a16c 100644 --- a/autorest/codegen/templates/client.py.jinja2 +++ b/autorest/codegen/templates/client.py.jinja2 @@ -6,7 +6,7 @@ {{ imports }} -{{ serializer.class_definition(async_mode) }} +{{ serializer.class_definition }} """{{ op_tools.wrap_string(code_model.client.description, "\n") | indent }} {{ op_tools.serialize_with_wrap(serializer.property_descriptions(async_mode), "\n ") | indent }} @@ -15,7 +15,7 @@ super().__init__() {% endif %} {% if code_model.client.parameters.kwargs_to_pop %} - {{ op_tools.serialize(serializer.pop_kwargs_from_signature(async_mode)) | indent(8) }} + {{ op_tools.serialize(serializer.pop_kwargs_from_signature()) | indent(8) }} {% endif %} {% if code_model.client.has_parameterized_host %} {{ serializer.host_variable_name }} = {{ keywords.escape_str(code_model.client.url) }} diff --git a/autorest/codegen/templates/config.py.jinja2 b/autorest/codegen/templates/config.py.jinja2 index a36091ca5b2..8aae80a1dc8 100644 --- a/autorest/codegen/templates/config.py.jinja2 +++ b/autorest/codegen/templates/config.py.jinja2 @@ -23,7 +23,7 @@ class {{ code_model.client.name }}Configuration(Configuration): # pylint: disab {{ serializer.init_signature_and_response_type_annotation(async_mode) | indent }} super({{ code_model.client.name }}Configuration, self).__init__(**kwargs) {% if code_model.config.parameters.kwargs_to_pop %} - {{ op_tools.serialize(serializer.pop_kwargs_from_signature(async_mode)) | indent(8) }} + {{ op_tools.serialize(serializer.pop_kwargs_from_signature()) | indent(8) }} {% endif %} {% if serializer.check_required_parameters() %} {{ op_tools.serialize(serializer.check_required_parameters()) | indent(8) -}} From b7ee3205c52bcd74f7775b557fb44a1486516bde Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 13 Jun 2022 09:41:04 -0700 Subject: [PATCH 5/6] lint --- autorest/codegen/serializers/client_serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autorest/codegen/serializers/client_serializer.py b/autorest/codegen/serializers/client_serializer.py index d0e2330eaa2..42f63cdbbb3 100644 --- a/autorest/codegen/serializers/client_serializer.py +++ b/autorest/codegen/serializers/client_serializer.py @@ -155,7 +155,7 @@ def _send_request_signature(self) -> str: def send_request_signature_and_response_type_annotation( self, async_mode: bool ) -> str: - send_request_signature = self._send_request_signature(async_mode) + send_request_signature = self._send_request_signature() return utils.method_signature_and_response_type_annotation_template( method_signature=send_request_signature, response_type_annotation="Awaitable[AsyncHttpResponse]" From c1a3500f00e0f97b7d7dee6bb3fd7eac3070a835 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 13 Jun 2022 12:22:07 -0700 Subject: [PATCH 6/6] remove python3operationfiles and python3only tests --- tasks.py | 4 - .../__init__.py | 24 - .../_auto_rest_swagger_bat_array_service.py | 73 - .../_configuration.py | 42 - .../_patch.py | 24 - .../_serialization.py | 1970 ------- .../_vendor.py | 16 - .../_version.py | 9 - .../aio/__init__.py | 21 - .../_auto_rest_swagger_bat_array_service.py | 70 - .../aio/_configuration.py | 39 - .../aio/_patch.py | 24 - .../aio/operations/__init__.py | 19 - .../aio/operations/_array_operations.py | 4136 -------------- .../aio/operations/_patch.py | 24 - .../models/__init__.py | 27 - ...to_rest_swagger_bat_array_service_enums.py | 34 - .../models/_models_py3.py | 64 - .../models/_patch.py | 24 - .../operations/__init__.py | 19 - .../operations/_array_operations.py | 5089 ----------------- .../operations/_array_operations_py3.py | 4951 ---------------- .../operations/_patch.py | 24 - .../py.typed | 1 - .../setup.py | 30 - .../_auto_rest_complex_test_service.py | 114 - .../aio/_auto_rest_complex_test_service.py | 112 - 27 files changed, 16984 deletions(-) delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/__init__.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_auto_rest_swagger_bat_array_service.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_configuration.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_patch.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_serialization.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_vendor.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_version.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/__init__.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_auto_rest_swagger_bat_array_service.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_configuration.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_patch.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/__init__.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_array_operations.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_patch.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_auto_rest_swagger_bat_array_service_enums.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models_py3.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_patch.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/__init__.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_patch.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/py.typed delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/setup.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_auto_rest_complex_test_service.py delete mode 100644 test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py diff --git a/tasks.py b/tasks.py index 7af5d5a4052..ed40d31c4a2 100644 --- a/tasks.py +++ b/tasks.py @@ -92,7 +92,6 @@ class Config(NamedTuple): _SwaggerGroup.VANILLA: { 'BodyArrayWithNamespaceFolders': 'body-array.json', 'BodyByteWithPackageName': 'body-byte.json', - 'BodyArrayWithPythonThreeOperationFiles': 'body-array.json', 'SecurityAadSwaggerCredentialFlag': 'security-aad.json', 'SecurityKeySwaggerCredentialFlag': 'security-key.json', }, @@ -124,9 +123,6 @@ class Config(NamedTuple): "credential-default-policy-type": "AzureKeyCredentialPolicy", "credential-key-header-name": "Authorization" }, - "BodyArrayWithPythonThreeOperationFiles": { - "add-python3-operation-files": True - }, "SecurityAadSwaggerCredentialFlag": { "add-credential": True, "credential-default-policy-type": "AzureKeyCredentialPolicy", diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/__init__.py deleted file mode 100644 index 4350b960171..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = ["AutoRestSwaggerBATArrayService"] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_auto_rest_swagger_bat_array_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_auto_rest_swagger_bat_array_service.py deleted file mode 100644 index 4b8d95c78e9..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_auto_rest_swagger_bat_array_service.py +++ /dev/null @@ -1,73 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any - -from azure.core import PipelineClient -from azure.core.rest import HttpRequest, HttpResponse - -from . import models -from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration -from ._serialization import Deserializer, Serializer -from .operations import ArrayOperations - - -class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword - """Test Infrastructure for AutoRest Swagger BAT. - - :ivar array: ArrayOperations operations - :vartype array: bodyarraywithpythonthreeoperationfiles.operations.ArrayOperations - :param base_url: Service URL. Default value is "http://localhost:3000". - :type base_url: str - """ - - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> AutoRestSwaggerBATArrayService - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_configuration.py deleted file mode 100644 index 65295dce353..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_configuration.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -from ._version import VERSION - - -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AutoRestSwaggerBATArrayService. - - Note that all parameters used to create this instance are saved as instance - attributes. - """ - - def __init__(self, **kwargs: Any) -> None: - super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_patch.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_patch.py deleted file mode 100644 index e5b7773d020..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_patch.py +++ /dev/null @@ -1,24 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import List - -__all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_serialization.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_serialization.py deleted file mode 100644 index 7daa7a447db..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_serialization.py +++ /dev/null @@ -1,1970 +0,0 @@ -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# pylint: skip-file - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote # type: ignore -import xml.etree.ElementTree as ET - -import isodate - -from typing import Dict, Any, cast, TYPE_CHECKING - -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) - except ET.ParseError: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - - -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 as _FixedOffset -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc # type: ignore -except ImportError: - TZ_UTC = UTC() # type: ignore - -_FLATTEN = re.compile(r"(? y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes=None): - 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, - "time": Serializer.serialize_time, - "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, - } - self.dependencies = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize(self, target_obj, data_type=None, **kwargs): - """Serialize data into a string according to type. - - :param target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises: SerializationError if serialization fails. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() - try: - attributes = target_obj._attribute_map - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) - continue - if xml_desc.get("text", False): - serialized.text = new_attr - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) - serialized.append(local_node) - else: # JSON - for k in reversed(keys): - unflattened = {k: new_attr} - new_attr = unflattened - - _new_attr = new_attr - _serialized = serialized - for k in keys: - if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] - _serialized = _serialized[k] - except ValueError: - continue - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) - else: - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None - """ - - # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) - except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param data: The data to be serialized. - :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - elif data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) - else: - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param data: Object to be serialized. - :param str data_type: Type of object in the iterable. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - return eval(data_type)(data) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param data: Object to be serialized. - :rtype: str - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - else: - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list attr: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - :rtype: list, str - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: - serialized.append(None) - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. - :rtype: dict - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is unicode_str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) - return result - 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. - - :param attr: Object to be serialized. - :rtype: str - """ - 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).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): - """Serialize Decimal object to float. - - :param attr: Object to be serialized. - :rtype: float - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): - """Serialize long (Py2) or int (Py3). - - :param attr: Object to be serialized. - :rtype: int/long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :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.") - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises: SerializationError if format invalid. - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - 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): - """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.") - - -def rest_key_extractor(attr, attr_desc, data): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor(attr, attr_desc, data): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer(object): - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes=None): - 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, - "time": Deserializer.deserialize_time, - "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, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, basestring): - return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None: - return data - try: - attributes = response._attribute_map - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name - raise_with_traceback(DeserializationError, msg, err) - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. - """ - if target is None: - return None, None - - if isinstance(target, basestring): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. - :param str content_type: Swagger "produces" if available. - """ - try: - return self(target_obj, data, content_type=content_type) - except: - _LOGGER.warning( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param response: The response model class. - :param d_attrs: The deserialized response attributes. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) - raise DeserializationError(msg + str(err)) - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) - - def deserialize_data(self, data, data_type): - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. - :return: Deserialized object. - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) - else: - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :rtype: dict - :raises: TypeError if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, basestring): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - elif isinstance(attr, basestring): - if attr.lower() in ["true", "1"]: - return True - elif attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - return eval(data_type)(attr) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): - return data - except NameError: - return str(data) - else: - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 - try: - return list(enum_obj.__members__.values())[data] - except IndexError: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :rtype: bytearray - :raises: TypeError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - 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. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(attr) - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :rtype: long or int - :raises: ValueError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :rtype: TimeDelta - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) - else: - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :rtype: Date - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :rtype: datetime.time - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: Datetime - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :rtype: Datetime - :raises: DeserializationError if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) - else: - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :rtype: Datetime - :raises: DeserializationError if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) - 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 diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_vendor.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_vendor.py deleted file mode 100644 index 0dafe0e287f..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_version.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_version.py deleted file mode 100644 index eae7c95b6fb..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "0.1.0" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/__init__.py deleted file mode 100644 index c7d46907ce9..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = ["AutoRestSwaggerBATArrayService"] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_auto_rest_swagger_bat_array_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_auto_rest_swagger_bat_array_service.py deleted file mode 100644 index 59f81b53804..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_auto_rest_swagger_bat_array_service.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable - -from azure.core import AsyncPipelineClient -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .. import models -from .._serialization import Deserializer, Serializer -from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration -from .operations import ArrayOperations - - -class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword - """Test Infrastructure for AutoRest Swagger BAT. - - :ivar array: ArrayOperations operations - :vartype array: bodyarraywithpythonthreeoperationfiles.aio.operations.ArrayOperations - :param base_url: Service URL. Default value is "http://localhost:3000". - :type base_url: str - """ - - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestSwaggerBATArrayServiceConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AutoRestSwaggerBATArrayService": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_configuration.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_configuration.py deleted file mode 100644 index 8f8d31c319a..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_configuration.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies - -from .._version import VERSION - - -class AutoRestSwaggerBATArrayServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AutoRestSwaggerBATArrayService. - - Note that all parameters used to create this instance are saved as instance - attributes. - """ - - def __init__(self, **kwargs: Any) -> None: - super(AutoRestSwaggerBATArrayServiceConfiguration, self).__init__(**kwargs) - - kwargs.setdefault("sdk_moniker", "autorestswaggerbatarrayservice/{}".format(VERSION)) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_patch.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_patch.py deleted file mode 100644 index e5b7773d020..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/_patch.py +++ /dev/null @@ -1,24 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import List - -__all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/__init__.py deleted file mode 100644 index 00dc72a5167..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._array_operations import ArrayOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ArrayOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_array_operations.py deleted file mode 100644 index dfab5d06a8a..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_array_operations.py +++ /dev/null @@ -1,4136 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._array_operations import ( - build_get_array_empty_request, - build_get_array_item_empty_request, - build_get_array_item_null_request, - build_get_array_null_request, - build_get_array_valid_request, - build_get_base64_url_request, - build_get_boolean_invalid_null_request, - build_get_boolean_invalid_string_request, - build_get_boolean_tfft_request, - build_get_byte_invalid_null_request, - build_get_byte_valid_request, - build_get_complex_empty_request, - build_get_complex_item_empty_request, - build_get_complex_item_null_request, - build_get_complex_null_request, - build_get_complex_valid_request, - build_get_date_invalid_chars_request, - build_get_date_invalid_null_request, - build_get_date_time_invalid_chars_request, - build_get_date_time_invalid_null_request, - build_get_date_time_rfc1123_valid_request, - build_get_date_time_valid_request, - build_get_date_valid_request, - build_get_dictionary_empty_request, - build_get_dictionary_item_empty_request, - build_get_dictionary_item_null_request, - build_get_dictionary_null_request, - build_get_dictionary_valid_request, - build_get_double_invalid_null_request, - build_get_double_invalid_string_request, - build_get_double_valid_request, - build_get_duration_valid_request, - build_get_empty_request, - build_get_enum_valid_request, - build_get_float_invalid_null_request, - build_get_float_invalid_string_request, - build_get_float_valid_request, - build_get_int_invalid_null_request, - build_get_int_invalid_string_request, - build_get_integer_valid_request, - build_get_invalid_request, - build_get_long_invalid_null_request, - build_get_long_invalid_string_request, - build_get_long_valid_request, - build_get_null_request, - build_get_string_enum_valid_request, - build_get_string_valid_request, - build_get_string_with_invalid_request, - build_get_string_with_null_request, - build_get_uuid_invalid_chars_request, - build_get_uuid_valid_request, - build_put_array_valid_request, - build_put_boolean_tfft_request, - build_put_byte_valid_request, - build_put_complex_valid_request, - build_put_date_time_rfc1123_valid_request, - build_put_date_time_valid_request, - build_put_date_valid_request, - build_put_dictionary_valid_request, - build_put_double_valid_request, - build_put_duration_valid_request, - build_put_empty_request, - build_put_enum_valid_request, - build_put_float_valid_request, - build_put_integer_valid_request, - build_put_long_valid_request, - build_put_string_enum_valid_request, - build_put_string_valid_request, - build_put_uuid_valid_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ArrayOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~bodyarraywithpythonthreeoperationfiles.aio.AutoRestSwaggerBATArrayService`'s - :attr:`array` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get_null(self, **kwargs: Any) -> List[int]: - """Get null array value. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_null_request( - template_url=self.get_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_null.metadata = {"url": "/array/null"} # type: ignore - - @distributed_trace_async - async def get_invalid(self, **kwargs: Any) -> List[int]: - """Get invalid array [1, 2, 3. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore - - @distributed_trace_async - async def get_empty(self, **kwargs: Any) -> List[int]: - """Get empty array value []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_empty.metadata = {"url": "/array/empty"} # type: ignore - - @overload - async def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_empty_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_empty.metadata = {"url": "/array/empty"} # type: ignore - - @distributed_trace_async - async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, false, false, true]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore - - @overload - async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: List[bool], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Required. - :type array_body: list[bool] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[bool], IO], **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[bool] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[bool]") - - request = build_put_boolean_tfft_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_boolean_tfft.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore - - @distributed_trace_async - async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, null, false]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore - - @distributed_trace_async - async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, 'boolean', false]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore - - @distributed_trace_async - async def get_integer_valid(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, -1, 3, 300]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore - - @overload - async def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[int], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: list[int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[int], IO], **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[int]") - - request = build_put_integer_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_integer_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore - - @distributed_trace_async - async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, null, 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore - - @distributed_trace_async - async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, 'integer', 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore - - @distributed_trace_async - async def get_long_valid(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, -1, 3, 300]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore - - @overload - async def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[int], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: list[int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[int], IO], **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[int]") - - request = build_put_long_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_long_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore - - @distributed_trace_async - async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: - """Get long array value [1, null, 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore - - @distributed_trace_async - async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: - """Get long array value [1, 'integer', 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore - - @distributed_trace_async - async def get_float_valid(self, **kwargs: Any) -> List[float]: - """Get float array value [0, -0.01, 1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore - - @overload - async def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[float], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: list[float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[float], IO], **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[float]") - - request = build_put_float_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_float_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore - - @distributed_trace_async - async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: - """Get float array value [0.0, null, -1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore - - @distributed_trace_async - async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: - """Get boolean array value [1.0, 'number', 0.0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore - - @distributed_trace_async - async def get_double_valid(self, **kwargs: Any) -> List[float]: - """Get float array value [0, -0.01, 1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore - - @overload - async def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[float], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: list[float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[float], IO], **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[float]") - - request = build_put_double_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_double_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore - - @distributed_trace_async - async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: - """Get float array value [0.0, null, -1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore - - @distributed_trace_async - async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: - """Get boolean array value [1.0, 'number', 0.0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore - - @distributed_trace_async - async def get_string_valid(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore - - @overload - async def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_string_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_string_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore - - @distributed_trace_async - async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: - """Get enum array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of FooEnum or the result of cls(response) - :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - - request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore - - @overload - async def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Union[str, "_models.FooEnum"]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Union[str, "_models.FooEnum"]], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_enum_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore - - @distributed_trace_async - async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0"]]: - """Get enum array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Enum0 or the result of cls(response) - :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum0] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - - request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore - - @overload - async def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Union[str, "_models.Enum1"]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum1] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Union[str, "_models.Enum1"]], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum1] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_string_enum_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_string_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore - - @distributed_trace_async - async def get_string_with_null(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo', null, 'foo2']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore - - @distributed_trace_async - async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo', 123, 'foo2']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore - - @distributed_trace_async - async def get_uuid_valid(self, **kwargs: Any) -> List[str]: - """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore - - @overload - async def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_uuid_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_uuid_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore - - @distributed_trace_async - async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: - """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore - - @distributed_trace_async - async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: - """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore - - @overload - async def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.date], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Required. - :type array_body: list[~datetime.date] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.date], IO], **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.date] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[date]") - - request = build_put_date_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore - - @distributed_trace_async - async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: - """Get date array value ['2012-01-01', null, '1776-07-04']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore - - @distributed_trace_async - async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: - """Get date array value ['2011-03-22', 'date']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore - - @distributed_trace_async - async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore - - @overload - async def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.datetime], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Required. - :type array_body: list[~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.datetime], IO], **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[iso-8601]") - - request = build_put_date_time_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_time_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore - - @distributed_trace_async - async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date array value ['2000-12-01t00:00:01z', null]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore - - @distributed_trace_async - async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date array value ['2000-12-01t00:00:01z', 'date-time']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore - - @distributed_trace_async - async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', - 'Wed, 12 Oct 1492 10:15:01 GMT']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[rfc-1123]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore - - @overload - async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.datetime], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Required. - :type array_body: list[~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.datetime], IO], **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[rfc-1123]") - - request = build_put_date_time_rfc1123_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore - - @distributed_trace_async - async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: - """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of timedelta or the result of cls(response) - :rtype: list[~datetime.timedelta] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - - request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[duration]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore - - @overload - async def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.timedelta], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Required. - :type array_body: list[~datetime.timedelta] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.timedelta], IO], **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.timedelta] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[duration]") - - request = build_put_duration_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_duration_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore - - @distributed_trace_async - async def get_byte_valid(self, **kwargs: Any) -> List[bytes]: - """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded - in base64. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bytearray]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore - - @overload - async def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Required. - :type array_body: list[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[bytes], IO], **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[bytes] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[bytearray]") - - request = build_put_byte_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_byte_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore - - @distributed_trace_async - async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: - """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bytearray]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore - - @distributed_trace_async - async def get_base64_url(self, **kwargs: Any) -> List[bytes]: - """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with - the items base64url encoded. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[base64]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore - - @distributed_trace_async - async def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type null value. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore - - @distributed_trace_async - async def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: - """Get empty array of complex type []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore - - @distributed_trace_async - async def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, - 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore - - @distributed_trace_async - async def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, - 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore - - @distributed_trace_async - async def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, - {'integer': 5, 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore - - @overload - async def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[_models.Product], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Required. - :type array_body: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[_models.Product], IO], **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~bodyarraywithpythonthreeoperationfiles.models.Product] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[Product]") - - request = build_put_complex_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_complex_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore - - @distributed_trace_async - async def get_array_null(self, **kwargs: Any) -> List[List[str]]: - """Get a null array. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore - - @distributed_trace_async - async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: - """Get an empty array []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore - - @distributed_trace_async - async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore - - @distributed_trace_async - async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore - - @distributed_trace_async - async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore - - @overload - async def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[List[str]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Required. - :type array_body: list[list[str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[List[str]], IO], **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[list[str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[[str]]") - - request = build_put_array_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_array_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore - - @distributed_trace_async - async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries with value null. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore - - @distributed_trace_async - async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore - - @distributed_trace_async - async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore - - @distributed_trace_async - async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore - - @distributed_trace_async - async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore - - @overload - async def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Dict[str, str]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Required. - :type array_body: list[dict[str, str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Dict[str, str]], IO], **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[dict[str, str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[{str}]") - - request = build_put_dictionary_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_dictionary_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_patch.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_patch.py deleted file mode 100644 index e5b7773d020..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/aio/operations/_patch.py +++ /dev/null @@ -1,24 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import List - -__all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py deleted file mode 100644 index 8613fef599f..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import Error -from ._models_py3 import Product - -from ._auto_rest_swagger_bat_array_service_enums import Enum0 -from ._auto_rest_swagger_bat_array_service_enums import Enum1 -from ._auto_rest_swagger_bat_array_service_enums import FooEnum -from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Error", - "Product", - "Enum0", - "Enum1", - "FooEnum", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_auto_rest_swagger_bat_array_service_enums.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_auto_rest_swagger_bat_array_service_enums.py deleted file mode 100644 index cd601343528..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_auto_rest_swagger_bat_array_service_enums.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class Enum0(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum0.""" - - FOO1 = "foo1" - FOO2 = "foo2" - FOO3 = "foo3" - - -class Enum1(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum1.""" - - FOO1 = "foo1" - FOO2 = "foo2" - FOO3 = "foo3" - - -class FooEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """FooEnum.""" - - FOO1 = "foo1" - FOO2 = "foo2" - FOO3 = "foo3" diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models_py3.py deleted file mode 100644 index 9e56fafd170..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_models_py3.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Optional - -from .. import _serialization - - -class Error(_serialization.Model): - """Error. - - :ivar status: - :vartype status: int - :ivar message: - :vartype message: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "int"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, status: Optional[int] = None, message: Optional[str] = None, **kwargs): - """ - :keyword status: - :paramtype status: int - :keyword message: - :paramtype message: str - """ - super().__init__(**kwargs) - self.status = status - self.message = message - - -class Product(_serialization.Model): - """Product. - - :ivar integer: - :vartype integer: int - :ivar string: - :vartype string: str - """ - - _attribute_map = { - "integer": {"key": "integer", "type": "int"}, - "string": {"key": "string", "type": "str"}, - } - - def __init__(self, *, integer: Optional[int] = None, string: Optional[str] = None, **kwargs): - """ - :keyword integer: - :paramtype integer: int - :keyword string: - :paramtype string: str - """ - super().__init__(**kwargs) - self.integer = integer - self.string = string diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_patch.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_patch.py deleted file mode 100644 index e5b7773d020..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/models/_patch.py +++ /dev/null @@ -1,24 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import List - -__all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/__init__.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/__init__.py deleted file mode 100644 index 00dc72a5167..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._array_operations import ArrayOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ArrayOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations.py deleted file mode 100644 index a60aa78093f..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations.py +++ /dev/null @@ -1,5089 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/null") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/invalid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/empty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/empty") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/boolean/tfft") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_boolean_tfft_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/boolean/tfft") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/boolean/true.null.false") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/boolean/true.boolean.false") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/integer/1.-1.3.300") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_integer_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/integer/1.-1.3.300") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/integer/1.null.zero") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/integer/1.integer.0") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/long/1.-1.3.300") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_long_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/long/1.-1.3.300") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/long/1.null.zero") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/long/1.integer.0") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/float/0--0.01-1.2e20") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_float_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/float/0--0.01-1.2e20") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/float/0.0-null-1.2e20") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/float/1.number.0") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/double/0--0.01-1.2e20") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_double_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/double/0--0.01-1.2e20") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/double/0.0-null-1.2e20") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/double/1.number.0") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string/foo1.foo2.foo3") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_string_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string/foo1.foo2.foo3") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_enum_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/enum/foo1.foo2.foo3") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_enum_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/enum/foo1.foo2.foo3") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string-enum/foo1.foo2.foo3") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_string_enum_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string-enum/foo1.foo2.foo3") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string/foo.null.foo2") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string/foo.123.foo2") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/uuid/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_uuid_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/uuid/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_uuid_invalid_chars_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/uuid/invalidchars") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_date_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date/invalidnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date/invalidchars") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_date_time_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time/invalidnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time/invalidchars") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time-rfc1123/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time-rfc1123/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/duration/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_duration_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/duration/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/byte/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_byte_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/byte/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/byte/invalidnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/base64url/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/null") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/empty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/itemnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/itemempty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_complex_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_array_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/null") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/empty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/itemnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/itemempty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_array_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/null") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/empty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/itemnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/itemempty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_dictionary_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -class ArrayOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~bodyarraywithpythonthreeoperationfiles.AutoRestSwaggerBATArrayService`'s - :attr:`array` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get_null(self, **kwargs: Any) -> List[int]: - """Get null array value. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_null_request( - template_url=self.get_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_null.metadata = {"url": "/array/null"} # type: ignore - - @distributed_trace - def get_invalid(self, **kwargs: Any) -> List[int]: - """Get invalid array [1, 2, 3. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore - - @distributed_trace - def get_empty(self, **kwargs: Any) -> List[int]: - """Get empty array value []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_empty.metadata = {"url": "/array/empty"} # type: ignore - - @overload - def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_empty_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_empty.metadata = {"url": "/array/empty"} # type: ignore - - @distributed_trace - def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, false, false, true]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore - - @overload - def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: List[bool], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Required. - :type array_body: list[bool] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[bool], IO], **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[bool] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[bool]") - - request = build_put_boolean_tfft_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_boolean_tfft.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore - - @distributed_trace - def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, null, false]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore - - @distributed_trace - def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, 'boolean', false]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore - - @distributed_trace - def get_integer_valid(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, -1, 3, 300]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore - - @overload - def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[int], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: list[int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[int], IO], **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[int]") - - request = build_put_integer_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_integer_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore - - @distributed_trace - def get_int_invalid_null(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, null, 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore - - @distributed_trace - def get_int_invalid_string(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, 'integer', 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore - - @distributed_trace - def get_long_valid(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, -1, 3, 300]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore - - @overload - def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[int], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: list[int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[int], IO], **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[int]") - - request = build_put_long_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_long_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore - - @distributed_trace - def get_long_invalid_null(self, **kwargs: Any) -> List[int]: - """Get long array value [1, null, 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore - - @distributed_trace - def get_long_invalid_string(self, **kwargs: Any) -> List[int]: - """Get long array value [1, 'integer', 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore - - @distributed_trace - def get_float_valid(self, **kwargs: Any) -> List[float]: - """Get float array value [0, -0.01, 1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore - - @overload - def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[float], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: list[float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[float], IO], **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[float]") - - request = build_put_float_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_float_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore - - @distributed_trace - def get_float_invalid_null(self, **kwargs: Any) -> List[float]: - """Get float array value [0.0, null, -1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore - - @distributed_trace - def get_float_invalid_string(self, **kwargs: Any) -> List[float]: - """Get boolean array value [1.0, 'number', 0.0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore - - @distributed_trace - def get_double_valid(self, **kwargs: Any) -> List[float]: - """Get float array value [0, -0.01, 1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore - - @overload - def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[float], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: list[float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[float], IO], **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[float]") - - request = build_put_double_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_double_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore - - @distributed_trace - def get_double_invalid_null(self, **kwargs: Any) -> List[float]: - """Get float array value [0.0, null, -1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore - - @distributed_trace - def get_double_invalid_string(self, **kwargs: Any) -> List[float]: - """Get boolean array value [1.0, 'number', 0.0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore - - @distributed_trace - def get_string_valid(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore - - @overload - def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_string_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_string_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore - - @distributed_trace - def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: - """Get enum array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of FooEnum or the result of cls(response) - :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - - request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore - - @overload - def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Union[str, "_models.FooEnum"]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Union[str, "_models.FooEnum"]], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_enum_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore - - @distributed_trace - def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0"]]: - """Get enum array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Enum0 or the result of cls(response) - :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum0] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - - request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore - - @overload - def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Union[str, "_models.Enum1"]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum1] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Union[str, "_models.Enum1"]], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum1] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_string_enum_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_string_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore - - @distributed_trace - def get_string_with_null(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo', null, 'foo2']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore - - @distributed_trace - def get_string_with_invalid(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo', 123, 'foo2']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore - - @distributed_trace - def get_uuid_valid(self, **kwargs: Any) -> List[str]: - """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore - - @overload - def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - - request = build_put_uuid_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_uuid_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore - - @distributed_trace - def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: - """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore - - @distributed_trace - def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: - """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore - - @overload - def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.date], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Required. - :type array_body: list[~datetime.date] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.date], IO], **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.date] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[date]") - - request = build_put_date_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore - - @distributed_trace - def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: - """Get date array value ['2012-01-01', null, '1776-07-04']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore - - @distributed_trace - def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: - """Get date array value ['2011-03-22', 'date']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore - - @distributed_trace - def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore - - @overload - def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.datetime], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Required. - :type array_body: list[~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.datetime], IO], **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[iso-8601]") - - request = build_put_date_time_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_time_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore - - @distributed_trace - def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date array value ['2000-12-01t00:00:01z', null]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore - - @distributed_trace - def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date array value ['2000-12-01t00:00:01z', 'date-time']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore - - @distributed_trace - def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', - 'Wed, 12 Oct 1492 10:15:01 GMT']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[rfc-1123]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore - - @overload - def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.datetime], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Required. - :type array_body: list[~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.datetime], IO], **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[rfc-1123]") - - request = build_put_date_time_rfc1123_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore - - @distributed_trace - def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: - """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of timedelta or the result of cls(response) - :rtype: list[~datetime.timedelta] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - - request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[duration]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore - - @overload - def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.timedelta], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Required. - :type array_body: list[~datetime.timedelta] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.timedelta], IO], **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.timedelta] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[duration]") - - request = build_put_duration_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_duration_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore - - @distributed_trace - def get_byte_valid(self, **kwargs: Any) -> List[bytes]: - """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded - in base64. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bytearray]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore - - @overload - def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Required. - :type array_body: list[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[bytes], IO], **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[bytes] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[bytearray]") - - request = build_put_byte_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_byte_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore - - @distributed_trace - def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: - """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[bytearray]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore - - @distributed_trace - def get_base64_url(self, **kwargs: Any) -> List[bytes]: - """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with - the items base64url encoded. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[base64]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore - - @distributed_trace - def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type null value. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore - - @distributed_trace - def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: - """Get empty array of complex type []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore - - @distributed_trace - def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, - 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore - - @distributed_trace - def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, - 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore - - @distributed_trace - def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, - {'integer': 5, 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore - - @overload - def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[_models.Product], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Required. - :type array_body: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[_models.Product], IO], **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~bodyarraywithpythonthreeoperationfiles.models.Product] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[Product]") - - request = build_put_complex_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_complex_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore - - @distributed_trace - def get_array_null(self, **kwargs: Any) -> List[List[str]]: - """Get a null array. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore - - @distributed_trace - def get_array_empty(self, **kwargs: Any) -> List[List[str]]: - """Get an empty array []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore - - @distributed_trace - def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore - - @distributed_trace - def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore - - @distributed_trace - def get_array_valid(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore - - @overload - def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[List[str]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Required. - :type array_body: list[list[str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[List[str]], IO], **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[list[str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[[str]]") - - request = build_put_array_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_array_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore - - @distributed_trace - def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries with value null. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore - - @distributed_trace - def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore - - @distributed_trace - def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore - - @distributed_trace - def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore - - @distributed_trace - def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore - - @overload - def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Dict[str, str]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Required. - :type array_body: list[dict[str, str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Dict[str, str]], IO], **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[dict[str, str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[{str}]") - - request = build_put_dictionary_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_dictionary_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - - if cls: - return cls(pipeline_response, None, {}) - - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py deleted file mode 100644 index de3e6123809..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_array_operations_py3.py +++ /dev/null @@ -1,4951 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import datetime -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/null") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_invalid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/invalid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/empty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/empty") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_boolean_tfft_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/boolean/tfft") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_boolean_tfft_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/boolean/tfft") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_boolean_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/boolean/true.null.false") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_boolean_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/boolean/true.boolean.false") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_integer_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/integer/1.-1.3.300") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_integer_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/integer/1.-1.3.300") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_int_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/integer/1.null.zero") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_int_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/integer/1.integer.0") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_long_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/long/1.-1.3.300") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_long_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/long/1.-1.3.300") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_long_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/long/1.null.zero") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_long_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/long/1.integer.0") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_float_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/float/0--0.01-1.2e20") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_float_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/float/0--0.01-1.2e20") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_float_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/float/0.0-null-1.2e20") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_float_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/float/1.number.0") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_double_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/double/0--0.01-1.2e20") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_double_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/double/0--0.01-1.2e20") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_double_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/double/0.0-null-1.2e20") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_double_invalid_string_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/double/1.number.0") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_string_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string/foo1.foo2.foo3") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_string_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string/foo1.foo2.foo3") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_enum_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/enum/foo1.foo2.foo3") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_enum_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/enum/foo1.foo2.foo3") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_string_enum_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string-enum/foo1.foo2.foo3") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_string_enum_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string-enum/foo1.foo2.foo3") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_string_with_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string/foo.null.foo2") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_string_with_invalid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/string/foo.123.foo2") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_uuid_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/uuid/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_uuid_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/uuid/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_uuid_invalid_chars_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/uuid/invalidchars") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_date_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_date_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date/invalidnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_invalid_chars_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date/invalidchars") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_time_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_date_time_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_date_time_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time/invalidnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_time_invalid_chars_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time/invalidchars") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time-rfc1123/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_date_time_rfc1123_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/date-time-rfc1123/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_duration_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/duration/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_duration_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/duration/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_byte_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/byte/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_byte_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/byte/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_byte_invalid_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/byte/invalidnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_base64_url_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/prim/base64url/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/null") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/empty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_item_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/itemnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_item_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/itemempty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_complex_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_complex_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/complex/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_array_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/null") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_array_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/empty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_array_item_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/itemnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_array_item_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/itemempty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_array_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_array_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/array/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/null") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/empty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_item_null_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/itemnull") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_item_empty_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/itemempty") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_get_dictionary_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/valid") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) - - -def build_put_dictionary_valid_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/array/dictionary/valid") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) - - -class ArrayOperations(object): # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~bodyarraywithpythonthreeoperationfiles.AutoRestSwaggerBATArrayService`'s - :attr:`array` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get_null(self, **kwargs: Any) -> List[int]: - """Get null array value. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_null_request( - template_url=self.get_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_null.metadata = {"url": "/array/null"} # type: ignore - - @distributed_trace - def get_invalid(self, **kwargs: Any) -> List[int]: - """Get invalid array [1, 2, 3. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_invalid_request( - template_url=self.get_invalid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_invalid.metadata = {"url": "/array/invalid"} # type: ignore - - @distributed_trace - def get_empty(self, **kwargs: Any) -> List[int]: - """Get empty array value []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_empty_request( - template_url=self.get_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_empty.metadata = {"url": "/array/empty"} # type: ignore - - @overload - def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_empty( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value empty []. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - request = build_put_empty_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_empty.metadata = {"url": "/array/empty"} # type: ignore - - @distributed_trace - def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, false, false, true]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_tfft_request( - template_url=self.get_boolean_tfft.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore - - @overload - def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: List[bool], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Required. - :type array_body: list[bool] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_boolean_tfft( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[bool], IO], **kwargs: Any - ) -> None: - """Set array value empty [true, false, false, true]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[bool] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[bool]") - request = build_put_boolean_tfft_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_boolean_tfft.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_boolean_tfft.metadata = {"url": "/array/prim/boolean/tfft"} # type: ignore - - @distributed_trace - def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, null, false]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_invalid_null_request( - template_url=self.get_boolean_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_boolean_invalid_null.metadata = {"url": "/array/prim/boolean/true.null.false"} # type: ignore - - @distributed_trace - def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: - """Get boolean array value [true, 'boolean', false]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bool or the result of cls(response) - :rtype: list[bool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bool]] - - request = build_get_boolean_invalid_string_request( - template_url=self.get_boolean_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bool]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_boolean_invalid_string.metadata = {"url": "/array/prim/boolean/true.boolean.false"} # type: ignore - - @distributed_trace - def get_integer_valid(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, -1, 3, 300]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_integer_valid_request( - template_url=self.get_integer_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore - - @overload - def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[int], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: list[int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_integer_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[int], IO], **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[int]") - request = build_put_integer_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_integer_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_integer_valid.metadata = {"url": "/array/prim/integer/1.-1.3.300"} # type: ignore - - @distributed_trace - def get_int_invalid_null(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, null, 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_int_invalid_null_request( - template_url=self.get_int_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_int_invalid_null.metadata = {"url": "/array/prim/integer/1.null.zero"} # type: ignore - - @distributed_trace - def get_int_invalid_string(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, 'integer', 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_int_invalid_string_request( - template_url=self.get_int_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_int_invalid_string.metadata = {"url": "/array/prim/integer/1.integer.0"} # type: ignore - - @distributed_trace - def get_long_valid(self, **kwargs: Any) -> List[int]: - """Get integer array value [1, -1, 3, 300]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_valid_request( - template_url=self.get_long_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore - - @overload - def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[int], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: list[int] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_long_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[int], IO], **kwargs: Any - ) -> None: - """Set array value empty [1, -1, 3, 300]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[int] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[int]") - request = build_put_long_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_long_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_long_valid.metadata = {"url": "/array/prim/long/1.-1.3.300"} # type: ignore - - @distributed_trace - def get_long_invalid_null(self, **kwargs: Any) -> List[int]: - """Get long array value [1, null, 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_invalid_null_request( - template_url=self.get_long_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_long_invalid_null.metadata = {"url": "/array/prim/long/1.null.zero"} # type: ignore - - @distributed_trace - def get_long_invalid_string(self, **kwargs: Any) -> List[int]: - """Get long array value [1, 'integer', 0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of int or the result of cls(response) - :rtype: list[int] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[int]] - - request = build_get_long_invalid_string_request( - template_url=self.get_long_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[int]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_long_invalid_string.metadata = {"url": "/array/prim/long/1.integer.0"} # type: ignore - - @distributed_trace - def get_float_valid(self, **kwargs: Any) -> List[float]: - """Get float array value [0, -0.01, 1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_valid_request( - template_url=self.get_float_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore - - @overload - def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[float], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: list[float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_float_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[float], IO], **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[float]") - request = build_put_float_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_float_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_float_valid.metadata = {"url": "/array/prim/float/0--0.01-1.2e20"} # type: ignore - - @distributed_trace - def get_float_invalid_null(self, **kwargs: Any) -> List[float]: - """Get float array value [0.0, null, -1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_invalid_null_request( - template_url=self.get_float_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_float_invalid_null.metadata = {"url": "/array/prim/float/0.0-null-1.2e20"} # type: ignore - - @distributed_trace - def get_float_invalid_string(self, **kwargs: Any) -> List[float]: - """Get boolean array value [1.0, 'number', 0.0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_float_invalid_string_request( - template_url=self.get_float_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_float_invalid_string.metadata = {"url": "/array/prim/float/1.number.0"} # type: ignore - - @distributed_trace - def get_double_valid(self, **kwargs: Any) -> List[float]: - """Get float array value [0, -0.01, 1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_valid_request( - template_url=self.get_double_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore - - @overload - def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[float], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: list[float] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_double_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[float], IO], **kwargs: Any - ) -> None: - """Set array value [0, -0.01, 1.2e20]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[float] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[float]") - request = build_put_double_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_double_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_double_valid.metadata = {"url": "/array/prim/double/0--0.01-1.2e20"} # type: ignore - - @distributed_trace - def get_double_invalid_null(self, **kwargs: Any) -> List[float]: - """Get float array value [0.0, null, -1.2e20]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_invalid_null_request( - template_url=self.get_double_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_double_invalid_null.metadata = {"url": "/array/prim/double/0.0-null-1.2e20"} # type: ignore - - @distributed_trace - def get_double_invalid_string(self, **kwargs: Any) -> List[float]: - """Get boolean array value [1.0, 'number', 0.0]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of float or the result of cls(response) - :rtype: list[float] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[float]] - - request = build_get_double_invalid_string_request( - template_url=self.get_double_invalid_string.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[float]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_double_invalid_string.metadata = {"url": "/array/prim/double/1.number.0"} # type: ignore - - @distributed_trace - def get_string_valid(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_valid_request( - template_url=self.get_string_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore - - @overload - def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_string_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - request = build_put_string_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_string_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_string_valid.metadata = {"url": "/array/prim/string/foo1.foo2.foo3"} # type: ignore - - @distributed_trace - def get_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.FooEnum"]]: - """Get enum array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of FooEnum or the result of cls(response) - :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.FooEnum"]]] - - request = build_get_enum_valid_request( - template_url=self.get_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore - - @overload - def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Union[str, "_models.FooEnum"]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Union[str, "_models.FooEnum"]], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.FooEnum] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - request = build_put_enum_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_enum_valid.metadata = {"url": "/array/prim/enum/foo1.foo2.foo3"} # type: ignore - - @distributed_trace - def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, "_models.Enum0"]]: - """Get enum array value ['foo1', 'foo2', 'foo3']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Enum0 or the result of cls(response) - :rtype: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum0] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Union[str, "_models.Enum0"]]] - - request = build_get_string_enum_valid_request( - template_url=self.get_string_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore - - @overload - def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Union[str, "_models.Enum1"]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum1] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_string_enum_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Union[str, "_models.Enum1"]], IO], **kwargs: Any - ) -> None: - """Set array value ['foo1', 'foo2', 'foo3']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str or ~bodyarraywithpythonthreeoperationfiles.models.Enum1] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - request = build_put_string_enum_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_string_enum_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_string_enum_valid.metadata = {"url": "/array/prim/string-enum/foo1.foo2.foo3"} # type: ignore - - @distributed_trace - def get_string_with_null(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo', null, 'foo2']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_with_null_request( - template_url=self.get_string_with_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_string_with_null.metadata = {"url": "/array/prim/string/foo.null.foo2"} # type: ignore - - @distributed_trace - def get_string_with_invalid(self, **kwargs: Any) -> List[str]: - """Get string array value ['foo', 123, 'foo2']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_string_with_invalid_request( - template_url=self.get_string_with_invalid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_string_with_invalid.metadata = {"url": "/array/prim/string/foo.123.foo2"} # type: ignore - - @distributed_trace - def get_uuid_valid(self, **kwargs: Any) -> List[str]: - """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_uuid_valid_request( - template_url=self.get_uuid_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore - - @overload - def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[str], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Required. - :type array_body: list[str] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_uuid_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[str], IO], **kwargs: Any - ) -> None: - """Set array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', - 'd1399005-30f7-40d6-8da6-dd7c89ad34db', 'f42f6aa1-a5bc-4ddf-907e-5f915de43205']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[str] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[str]") - request = build_put_uuid_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_uuid_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_uuid_valid.metadata = {"url": "/array/prim/uuid/valid"} # type: ignore - - @distributed_trace - def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: - """Get uuid array value ['6dcc7237-45fe-45c4-8a6b-3a8a3f625652', 'foo']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of str or the result of cls(response) - :rtype: list[str] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[str]] - - request = build_get_uuid_invalid_chars_request( - template_url=self.get_uuid_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[str]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_uuid_invalid_chars.metadata = {"url": "/array/prim/uuid/invalidchars"} # type: ignore - - @distributed_trace - def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: - """Get integer array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_valid_request( - template_url=self.get_date_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore - - @overload - def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.date], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Required. - :type array_body: list[~datetime.date] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_date_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.date], IO], **kwargs: Any - ) -> None: - """Set array value ['2000-12-01', '1980-01-02', '1492-10-12']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.date] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[date]") - request = build_put_date_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_date_valid.metadata = {"url": "/array/prim/date/valid"} # type: ignore - - @distributed_trace - def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: - """Get date array value ['2012-01-01', null, '1776-07-04']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_invalid_null_request( - template_url=self.get_date_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_date_invalid_null.metadata = {"url": "/array/prim/date/invalidnull"} # type: ignore - - @distributed_trace - def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: - """Get date array value ['2011-03-22', 'date']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of date or the result of cls(response) - :rtype: list[~datetime.date] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.date]] - - request = build_get_date_invalid_chars_request( - template_url=self.get_date_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[date]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_date_invalid_chars.metadata = {"url": "/array/prim/date/invalidchars"} # type: ignore - - @distributed_trace - def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date-time array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_valid_request( - template_url=self.get_date_time_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore - - @overload - def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.datetime], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Required. - :type array_body: list[~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_date_time_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.datetime], IO], **kwargs: Any - ) -> None: - """Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', - '1492-10-12T10:15:01-08:00']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[iso-8601]") - request = build_put_date_time_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_time_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_date_time_valid.metadata = {"url": "/array/prim/date-time/valid"} # type: ignore - - @distributed_trace - def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date array value ['2000-12-01t00:00:01z', null]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_invalid_null_request( - template_url=self.get_date_time_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_date_time_invalid_null.metadata = {"url": "/array/prim/date-time/invalidnull"} # type: ignore - - @distributed_trace - def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date array value ['2000-12-01t00:00:01z', 'date-time']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_invalid_chars_request( - template_url=self.get_date_time_invalid_chars.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[iso-8601]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_date_time_invalid_chars.metadata = {"url": "/array/prim/date-time/invalidchars"} # type: ignore - - @distributed_trace - def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: - """Get date-time array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', - 'Wed, 12 Oct 1492 10:15:01 GMT']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of datetime or the result of cls(response) - :rtype: list[~datetime.datetime] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.datetime]] - - request = build_get_date_time_rfc1123_valid_request( - template_url=self.get_date_time_rfc1123_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[rfc-1123]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore - - @overload - def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.datetime], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Required. - :type array_body: list[~datetime.datetime] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.datetime], IO], **kwargs: Any - ) -> None: - """Set array value ['Fri, 01 Dec 2000 00:00:01 GMT', 'Wed, 02 Jan 1980 00:11:35 GMT', 'Wed, 12 - Oct 1492 10:15:01 GMT']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.datetime] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[rfc-1123]") - request = build_put_date_time_rfc1123_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_date_time_rfc1123_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_date_time_rfc1123_valid.metadata = {"url": "/array/prim/date-time-rfc1123/valid"} # type: ignore - - @distributed_trace - def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: - """Get duration array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of timedelta or the result of cls(response) - :rtype: list[~datetime.timedelta] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[datetime.timedelta]] - - request = build_get_duration_valid_request( - template_url=self.get_duration_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[duration]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore - - @overload - def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[datetime.timedelta], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Required. - :type array_body: list[~datetime.timedelta] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_duration_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[datetime.timedelta], IO], **kwargs: Any - ) -> None: - """Set array value ['P123DT22H14M12.011S', 'P5DT1H0M0S']. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~datetime.timedelta] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[duration]") - request = build_put_duration_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_duration_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_duration_valid.metadata = {"url": "/array/prim/duration/valid"} # type: ignore - - @distributed_trace - def get_byte_valid(self, **kwargs: Any) -> List[bytes]: - """Get byte array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each item encoded - in base64. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_byte_valid_request( - template_url=self.get_byte_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore - - @overload - def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Required. - :type array_body: list[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_byte_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[bytes], IO], **kwargs: Any - ) -> None: - """Put the array value [hex(FF FF FF FA), hex(01 02 03), hex (25, 29, 43)] with each - elementencoded in base 64. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[bytes] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[bytearray]") - request = build_put_byte_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_byte_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_byte_valid.metadata = {"url": "/array/prim/byte/valid"} # type: ignore - - @distributed_trace - def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: - """Get byte array value [hex(AB, AC, AD), null] with the first item base64 encoded. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_byte_invalid_null_request( - template_url=self.get_byte_invalid_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[bytearray]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_byte_invalid_null.metadata = {"url": "/array/prim/byte/invalidnull"} # type: ignore - - @distributed_trace - def get_base64_url(self, **kwargs: Any) -> List[bytes]: - """Get array value ['a string that gets encoded with base64url', 'test string' 'Lorem ipsum'] with - the items base64url encoded. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of bytes or the result of cls(response) - :rtype: list[bytes] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[bytes]] - - request = build_get_base64_url_request( - template_url=self.get_base64_url.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[base64]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_base64_url.metadata = {"url": "/array/prim/base64url/valid"} # type: ignore - - @distributed_trace - def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type null value. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_null_request( - template_url=self.get_complex_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_complex_null.metadata = {"url": "/array/complex/null"} # type: ignore - - @distributed_trace - def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: - """Get empty array of complex type []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_empty_request( - template_url=self.get_complex_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_complex_empty.metadata = {"url": "/array/complex/empty"} # type: ignore - - @distributed_trace - def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with null item [{'integer': 1 'string': '2'}, null, {'integer': 5, - 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_item_null_request( - template_url=self.get_complex_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_complex_item_null.metadata = {"url": "/array/complex/itemnull"} # type: ignore - - @distributed_trace - def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with empty item [{'integer': 1 'string': '2'}, {}, {'integer': 5, - 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_item_empty_request( - template_url=self.get_complex_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_complex_item_empty.metadata = {"url": "/array/complex/itemempty"} # type: ignore - - @distributed_trace - def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: - """Get array of complex type with [{'integer': 1 'string': '2'}, {'integer': 3, 'string': '4'}, - {'integer': 5, 'string': '6'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of Product or the result of cls(response) - :rtype: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[_models.Product]] - - request = build_get_complex_valid_request( - template_url=self.get_complex_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[Product]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore - - @overload - def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[_models.Product], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Required. - :type array_body: list[~bodyarraywithpythonthreeoperationfiles.models.Product] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_complex_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[_models.Product], IO], **kwargs: Any - ) -> None: - """Put an array of complex type with values [{'integer': 1 'string': '2'}, {'integer': 3, - 'string': '4'}, {'integer': 5, 'string': '6'}]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[~bodyarraywithpythonthreeoperationfiles.models.Product] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[Product]") - request = build_put_complex_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_complex_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_complex_valid.metadata = {"url": "/array/complex/valid"} # type: ignore - - @distributed_trace - def get_array_null(self, **kwargs: Any) -> List[List[str]]: - """Get a null array. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_null_request( - template_url=self.get_array_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_array_null.metadata = {"url": "/array/array/null"} # type: ignore - - @distributed_trace - def get_array_empty(self, **kwargs: Any) -> List[List[str]]: - """Get an empty array []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_empty_request( - template_url=self.get_array_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_array_empty.metadata = {"url": "/array/array/empty"} # type: ignore - - @distributed_trace - def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], null, ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_item_null_request( - template_url=self.get_array_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_array_item_null.metadata = {"url": "/array/array/itemnull"} # type: ignore - - @distributed_trace - def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], [], ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_item_empty_request( - template_url=self.get_array_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_array_item_empty.metadata = {"url": "/array/array/itemempty"} # type: ignore - - @distributed_trace - def get_array_valid(self, **kwargs: Any) -> List[List[str]]: - """Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of list of str or the result of cls(response) - :rtype: list[list[str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[List[str]]] - - request = build_get_array_valid_request( - template_url=self.get_array_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[[str]]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore - - @overload - def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[List[str]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Required. - :type array_body: list[list[str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_array_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[List[str]], IO], **kwargs: Any - ) -> None: - """Put An array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[list[str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[[str]]") - request = build_put_array_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_array_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_array_valid.metadata = {"url": "/array/array/valid"} # type: ignore - - @distributed_trace - def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries with value null. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_null_request( - template_url=self.get_dictionary_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_dictionary_null.metadata = {"url": "/array/dictionary/null"} # type: ignore - - @distributed_trace - def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value []. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_empty_request( - template_url=self.get_dictionary_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_dictionary_empty.metadata = {"url": "/array/dictionary/empty"} # type: ignore - - @distributed_trace - def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, null, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_item_null_request( - template_url=self.get_dictionary_item_null.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_dictionary_item_null.metadata = {"url": "/array/dictionary/itemnull"} # type: ignore - - @distributed_trace - def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_item_empty_request( - template_url=self.get_dictionary_item_empty.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_dictionary_item_empty.metadata = {"url": "/array/dictionary/itemempty"} # type: ignore - - @distributed_trace - def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: list of dict mapping str to str or the result of cls(response) - :rtype: list[dict[str, str]] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls = kwargs.pop("cls", None) # type: ClsType[List[Dict[str, str]]] - - request = build_get_dictionary_valid_request( - template_url=self.get_dictionary_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("[{str}]", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - get_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore - - @overload - def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: List[Dict[str, str]], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Required. - :type array_body: list[dict[str, str]] - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: IO, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Required. - :type array_body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put_dictionary_valid( # pylint: disable=inconsistent-return-statements - self, array_body: Union[List[Dict[str, str]], IO], **kwargs: Any - ) -> None: - """Get an array of Dictionaries of type with value [{'1': 'one', '2': 'two', '3': - 'three'}, {'4': 'four', '5': 'five', '6': 'six'}, {'7': 'seven', '8': 'eight', '9': 'nine'}]. - - :param array_body: Is either a list type or a IO type. Required. - :type array_body: list[dict[str, str]] or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(array_body, (IO, bytes)): - _content = array_body - else: - _json = self._serialize.body(array_body, "[{str}]") - request = build_put_dictionary_valid_request( - content_type=content_type, - json=_json, - content=_content, - template_url=self.put_dictionary_valid.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, pipeline_response) - raise HttpResponseError(response=response, model=error) - if cls: - return cls(pipeline_response, None, {}) - - put_dictionary_valid.metadata = {"url": "/array/dictionary/valid"} # type: ignore diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_patch.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_patch.py deleted file mode 100644 index e5b7773d020..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/operations/_patch.py +++ /dev/null @@ -1,24 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import List - -__all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/py.typed b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/py.typed deleted file mode 100644 index e5aff4f83af..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/bodyarraywithpythonthreeoperationfiles/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/setup.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/setup.py deleted file mode 100644 index 668ac041b5b..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithPythonThreeOperationFiles/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# coding: utf-8 -from setuptools import setup, find_packages - - -PACKAGE_NAME = "autorestswaggerbatarrayservice" -version = "0.1.0" -setup( - name=PACKAGE_NAME, - version=version, - description="AutoRestSwaggerBATArrayService", - author_email="", - url="", - keywords="azure, azure sdk", - packages=find_packages(), - include_package_data=True, - install_requires=[ - "msrest>=0.7.0", - "azure-core<2.0.0,>=1.24.0", - ], - long_description="""\ - Test Infrastructure for AutoRest Swagger BAT. - """, -) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_auto_rest_complex_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_auto_rest_complex_test_service.py deleted file mode 100644 index 252227c2a52..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/_auto_rest_complex_test_service.py +++ /dev/null @@ -1,114 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any - -from azure.core import PipelineClient -from azure.core.rest import HttpRequest, HttpResponse - -from . import models -from ._configuration import AutoRestComplexTestServiceConfiguration -from ._serialization import Deserializer, Serializer -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) - - -class AutoRestComplexTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Test Infrastructure for AutoRest. - - :ivar basic: BasicOperations operations - :vartype basic: bodycomplexpython3only.operations.BasicOperations - :ivar primitive: PrimitiveOperations operations - :vartype primitive: bodycomplexpython3only.operations.PrimitiveOperations - :ivar array: ArrayOperations operations - :vartype array: bodycomplexpython3only.operations.ArrayOperations - :ivar dictionary: DictionaryOperations operations - :vartype dictionary: bodycomplexpython3only.operations.DictionaryOperations - :ivar inheritance: InheritanceOperations operations - :vartype inheritance: bodycomplexpython3only.operations.InheritanceOperations - :ivar polymorphism: PolymorphismOperations operations - :vartype polymorphism: bodycomplexpython3only.operations.PolymorphismOperations - :ivar polymorphicrecursive: PolymorphicrecursiveOperations operations - :vartype polymorphicrecursive: bodycomplexpython3only.operations.PolymorphicrecursiveOperations - :ivar readonlyproperty: ReadonlypropertyOperations operations - :vartype readonlyproperty: bodycomplexpython3only.operations.ReadonlypropertyOperations - :ivar flattencomplex: FlattencomplexOperations operations - :vartype flattencomplex: bodycomplexpython3only.operations.FlattencomplexOperations - :param base_url: Service URL. Default value is "http://localhost:3000". - :type base_url: str - :keyword api_version: Api Version. Default value is "2016-02-29". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestComplexTestServiceConfiguration(**kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.basic = BasicOperations(self._client, self._config, self._serialize, self._deserialize) - self.primitive = PrimitiveOperations(self._client, self._config, self._serialize, self._deserialize) - self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) - self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) - self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> AutoRestComplexTestService - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py b/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py deleted file mode 100644 index 6ccd3420814..00000000000 --- a/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplexPythonThreeOnly/bodycomplexpython3only/aio/_auto_rest_complex_test_service.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable - -from azure.core import AsyncPipelineClient -from azure.core.rest import AsyncHttpResponse, HttpRequest - -from .. import models -from .._serialization import Deserializer, Serializer -from ._configuration import AutoRestComplexTestServiceConfiguration -from .operations import ( - ArrayOperations, - BasicOperations, - DictionaryOperations, - FlattencomplexOperations, - InheritanceOperations, - PolymorphicrecursiveOperations, - PolymorphismOperations, - PrimitiveOperations, - ReadonlypropertyOperations, -) - - -class AutoRestComplexTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Test Infrastructure for AutoRest. - - :ivar basic: BasicOperations operations - :vartype basic: bodycomplexpython3only.aio.operations.BasicOperations - :ivar primitive: PrimitiveOperations operations - :vartype primitive: bodycomplexpython3only.aio.operations.PrimitiveOperations - :ivar array: ArrayOperations operations - :vartype array: bodycomplexpython3only.aio.operations.ArrayOperations - :ivar dictionary: DictionaryOperations operations - :vartype dictionary: bodycomplexpython3only.aio.operations.DictionaryOperations - :ivar inheritance: InheritanceOperations operations - :vartype inheritance: bodycomplexpython3only.aio.operations.InheritanceOperations - :ivar polymorphism: PolymorphismOperations operations - :vartype polymorphism: bodycomplexpython3only.aio.operations.PolymorphismOperations - :ivar polymorphicrecursive: PolymorphicrecursiveOperations operations - :vartype polymorphicrecursive: - bodycomplexpython3only.aio.operations.PolymorphicrecursiveOperations - :ivar readonlyproperty: ReadonlypropertyOperations operations - :vartype readonlyproperty: bodycomplexpython3only.aio.operations.ReadonlypropertyOperations - :ivar flattencomplex: FlattencomplexOperations operations - :vartype flattencomplex: bodycomplexpython3only.aio.operations.FlattencomplexOperations - :param base_url: Service URL. Default value is "http://localhost:3000". - :type base_url: str - :keyword api_version: Api Version. Default value is "2016-02-29". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, base_url: str = "http://localhost:3000", **kwargs: Any) -> None: - self._config = AutoRestComplexTestServiceConfiguration(**kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.basic = BasicOperations(self._client, self._config, self._serialize, self._deserialize) - self.primitive = PrimitiveOperations(self._client, self._config, self._serialize, self._deserialize) - self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize) - self.dictionary = DictionaryOperations(self._client, self._config, self._serialize, self._deserialize) - self.inheritance = InheritanceOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphism = PolymorphismOperations(self._client, self._config, self._serialize, self._deserialize) - self.polymorphicrecursive = PolymorphicrecursiveOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.readonlyproperty = ReadonlypropertyOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.flattencomplex = FlattencomplexOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AutoRestComplexTestService": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details)