diff --git a/.vscode/launch.json b/.vscode/launch.json index e74570ad8f8..0f4e13f1791 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "cwd": "${workspaceFolder}/packages/typespec-python", "args": [ "compile", - "${workspaceFolder}/packages/typespec-python/main.tsp", + "${workspaceFolder}/packages/typespec-python/node_modules/@azure-tools/cadl-ranch-specs/http/server/versions/not-versioned", "--emit", "${workspaceFolder}/packages/typespec-python/dist/src/index.js", "--option=@azure-tools/typespec-python.debug=true" diff --git a/package.json b/package.json index 26c50d4105b..17659cf18c4 100644 --- a/package.json +++ b/package.json @@ -32,15 +32,15 @@ }, "homepage": "https://github.com/Azure/autorest.python#readme", "devDependencies": { + "@azure-tools/cadl-ranch": "~0.11.3", "@typespec/prettier-plugin-typespec": "~0.51.0", - "@azure-tools/cadl-ranch": "~0.11.2", "autorest": "3.6.3", - "eslint": "^8.44.0", - "eslint-plugin-import": "^2.27.5", - "eslint-plugin-unicorn": "^46.0.0", + "eslint": "^8.57.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-unicorn": "^46.0.1", "prettier": "^2.8.8", - "typescript": "~5.1.3", - "syncpack": "^9.8.6" + "syncpack": "^9.8.6", + "typescript": "~5.1.6" }, "syncpack": { "dependencyTypes": [ diff --git a/packages/autorest.python/ChangeLog.md b/packages/autorest.python/ChangeLog.md index fc6e6a5ccf5..caeee3dcee6 100644 --- a/packages/autorest.python/ChangeLog.md +++ b/packages/autorest.python/ChangeLog.md @@ -1,5 +1,21 @@ # Release +## 2024-04-05 - 6.13.9 + +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.9.2` | +| `@autorest/modelerfour` | `4.24.3` | +| `azure-core` dep of generated code | `1.30.0` | +| `isodate` dep of generated code | `0.6.1` | +| `msrest` dep of generated code (If generating legacy code) | `0.7.1` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` | +| `typing-extensions` dep of generated code (If generating with constants)| `4.0.1` | + +**Other Changes** + +- Refactor code to use the type ecosystem from "@azure-tools/typespec-client-generator-core" #2476 + ## 2024-03-22 - 6.13.8 | Library | Min Version | diff --git a/packages/autorest.python/autorest/codegen/models/constant_type.py b/packages/autorest.python/autorest/codegen/models/constant_type.py index afcb304e6db..3a8f11933f6 100644 --- a/packages/autorest.python/autorest/codegen/models/constant_type.py +++ b/packages/autorest.python/autorest/codegen/models/constant_type.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import Dict, Any, Optional, TYPE_CHECKING +from typing import Dict, Any, Optional, TYPE_CHECKING, Union from .base import BaseType from .imports import FileImport, ImportType, TypingSection from .primitive_types import IntegerType, BinaryType, StringType, BooleanType @@ -31,7 +31,7 @@ def __init__( yaml_data: Dict[str, Any], code_model: "CodeModel", value_type: BaseType, - value: Optional[str], + value: Optional[Union[str, int, float]], ) -> None: super().__init__(yaml_data=yaml_data, code_model=code_model) self.value_type = value_type diff --git a/packages/autorest.python/autorest/codegen/models/enum_type.py b/packages/autorest.python/autorest/codegen/models/enum_type.py index 7bbd8a11136..d5fa5505884 100644 --- a/packages/autorest.python/autorest/codegen/models/enum_type.py +++ b/packages/autorest.python/autorest/codegen/models/enum_type.py @@ -101,11 +101,10 @@ def from_yaml( """ from . import build_type - enum_type = cast(EnumType, code_model.lookup_type(id(yaml_data["enumType"]))) return cls( yaml_data=yaml_data, code_model=code_model, - enum_type=enum_type, + enum_type=cast(EnumType, build_type(yaml_data["enumType"], code_model)), value_type=build_type(yaml_data["valueType"], code_model), ) diff --git a/packages/autorest.python/autorest/codegen/models/operation.py b/packages/autorest.python/autorest/codegen/models/operation.py index fc6e23519aa..ea472d87cb9 100644 --- a/packages/autorest.python/autorest/codegen/models/operation.py +++ b/packages/autorest.python/autorest/codegen/models/operation.py @@ -389,6 +389,18 @@ def imports( # pylint: disable=too-many-branches, disable=too-many-statements file_import.add_submodule_import( "azure.mgmt.core.exceptions", "ARMErrorFormat", ImportType.SDKCORE ) + file_import.add_submodule_import( + "typing", + "Type", + ImportType.STDLIB, + ) + file_import.add_mutable_mapping_import() + if self.non_default_error_status_codes: + file_import.add_submodule_import( + "typing", + "cast", + ImportType.STDLIB, + ) if self.has_kwargs_to_pop_with_default( self.parameters.kwargs_to_pop, ParameterLocation.HEADER # type: ignore @@ -481,6 +493,10 @@ def imports( # pylint: disable=too-many-branches, disable=too-many-statements ) if self.overloads: file_import.add_submodule_import("typing", "overload", ImportType.STDLIB) + if self.non_default_errors and self.code_model.options["models_mode"] == "dpg": + file_import.add_submodule_import( + f"{relative_path}_model_base", "_deserialize", ImportType.LOCAL + ) return file_import def get_response_from_status( diff --git a/packages/autorest.python/autorest/codegen/models/parameter.py b/packages/autorest.python/autorest/codegen/models/parameter.py index 9625eb717ee..1fc0dbdb4b8 100644 --- a/packages/autorest.python/autorest/codegen/models/parameter.py +++ b/packages/autorest.python/autorest/codegen/models/parameter.py @@ -63,7 +63,7 @@ def __init__( type: BaseType, ) -> None: super().__init__(yaml_data, code_model) - self.wire_name: str = yaml_data["wireName"] + self.wire_name: str = yaml_data.get("wireName", "") self.client_name: str = self.yaml_data["clientName"] self.optional: bool = self.yaml_data["optional"] self.location: ParameterLocation = self.yaml_data["location"] @@ -373,7 +373,7 @@ def method_location( # pylint: disable=too-many-return-statements return ParameterMethodLocation.KEYWORD_ONLY if self.grouper: return ParameterMethodLocation.POSITIONAL - if self.constant: + if self.constant and self.wire_name != "Content-Type": return ParameterMethodLocation.KWARG if self.is_content_type: if self.in_overload: diff --git a/packages/autorest.python/autorest/codegen/models/response.py b/packages/autorest.python/autorest/codegen/models/response.py index d2e0d48b061..b275e8b1c91 100644 --- a/packages/autorest.python/autorest/codegen/models/response.py +++ b/packages/autorest.python/autorest/codegen/models/response.py @@ -37,10 +37,12 @@ def serialization_type(self) -> str: def from_yaml( cls, yaml_data: Dict[str, Any], code_model: "CodeModel" ) -> "ResponseHeader": + from . import build_type + return cls( yaml_data=yaml_data, code_model=code_model, - type=code_model.lookup_type(id(yaml_data["type"])), + type=build_type(yaml_data["type"], code_model), ) diff --git a/packages/autorest.python/autorest/codegen/serializers/builder_serializer.py b/packages/autorest.python/autorest/codegen/serializers/builder_serializer.py index de4be7502b5..c82a49fa6f6 100644 --- a/packages/autorest.python/autorest/codegen/serializers/builder_serializer.py +++ b/packages/autorest.python/autorest/codegen/serializers/builder_serializer.py @@ -1281,7 +1281,7 @@ def handle_response(self, builder: OperationType) -> List[str]: return retval def error_map(self, builder: OperationType) -> List[str]: - retval = ["error_map = {"] + retval = ["error_map: MutableMapping[int, Type[HttpResponseError]] = {"] if builder.non_default_errors: if not 401 in builder.non_default_error_status_codes: retval.append(" 401: ClientAuthenticationError,") @@ -1309,30 +1309,35 @@ def error_map(self, builder: OperationType) -> List[str]: for status_code in excep.status_codes: if status_code == 401: retval.append( - " 401: lambda response: ClientAuthenticationError(response=response" - f"{error_model_str}{error_format_str})," + " 401: cast(Type[HttpResponseError], " + "lambda response: ClientAuthenticationError(response=response" + f"{error_model_str}{error_format_str}))," ) elif status_code == 404: retval.append( - " 404: lambda response: ResourceNotFoundError(response=response" - f"{error_model_str}{error_format_str})," + " 404: cast(Type[HttpResponseError], " + "lambda response: ResourceNotFoundError(response=response" + f"{error_model_str}{error_format_str}))," ) elif status_code == 409: retval.append( - " 409: lambda response: ResourceExistsError(response=response" - f"{error_model_str}{error_format_str})," + " 409: cast(Type[HttpResponseError], " + "lambda response: ResourceExistsError(response=response" + f"{error_model_str}{error_format_str}))," ) elif status_code == 304: retval.append( - " 304: lambda response: ResourceNotModifiedError(response=response" - f"{error_model_str}{error_format_str})," + " 304: cast(Type[HttpResponseError], " + "lambda response: ResourceNotModifiedError(response=response" + f"{error_model_str}{error_format_str}))," ) elif not error_model_str and not error_format_str: retval.append(f" {status_code}: HttpResponseError,") else: retval.append( - f" {status_code}: lambda response: HttpResponseError(response=response" - f"{error_model_str}{error_format_str})," + f" {status_code}: cast(Type[HttpResponseError], " + "lambda response: HttpResponseError(response=response" + f"{error_model_str}{error_format_str}))," ) else: retval.append( diff --git a/packages/autorest.python/autorest/preprocess/__init__.py b/packages/autorest.python/autorest/preprocess/__init__.py index 6b3479c748a..e18fd4c4583 100644 --- a/packages/autorest.python/autorest/preprocess/__init__.py +++ b/packages/autorest.python/autorest/preprocess/__init__.py @@ -25,15 +25,18 @@ def update_overload_section( yaml_data: Dict[str, Any], section: str, ): - for overload_s, original_s in zip(overload[section], yaml_data[section]): - if overload_s.get("type"): - overload_s["type"] = original_s["type"] - if overload_s.get("headers"): - for overload_h, original_h in zip( - overload_s["headers"], original_s["headers"] - ): - if overload_h.get("type"): - overload_h["type"] = original_h["type"] + try: + for overload_s, original_s in zip(overload[section], yaml_data[section]): + if overload_s.get("type"): + overload_s["type"] = original_s["type"] + if overload_s.get("headers"): + for overload_h, original_h in zip( + overload_s["headers"], original_s["headers"] + ): + if overload_h.get("type"): + overload_h["type"] = original_h["type"] + except KeyError as exc: + raise ValueError(overload["name"]) from exc def add_overload( @@ -390,6 +393,11 @@ def update_parameter(self, yaml_data: Dict[str, Any]) -> None: and wire_name_lower in HEADERS_CONVERT_IN_METHOD ): headers_convert(yaml_data, HEADERS_CONVERT_IN_METHOD[wire_name_lower]) + if ( + wire_name_lower in ["$host", "content-type", "accept"] + and yaml_data["type"]["type"] == "constant" + ): + yaml_data["clientDefaultValue"] = yaml_data["type"]["value"] def update_operation( self, diff --git a/packages/autorest.python/package.json b/packages/autorest.python/package.json index b8c27d5f4d4..045b7555aeb 100644 --- a/packages/autorest.python/package.json +++ b/packages/autorest.python/package.json @@ -1,6 +1,6 @@ { "name": "@autorest/python", - "version": "6.13.8", + "version": "6.13.9", "description": "The Python extension for generators in AutoRest.", "scripts": { "prepare": "node run-python3.js prepare.py", diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_operations.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_operations.py index e4ba4a5fa5a..95dea1fd1f8 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_operations.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ build_http_success_head404_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +60,7 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +103,7 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +146,7 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_operations.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_operations.py index 9982290e051..15b8dd6ceb8 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_operations.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,7 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +123,7 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_operations.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_operations.py index 79881612bc2..dfc2e217633 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_operations.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ build_http_success_head404_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +60,7 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +103,7 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +146,7 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_operations.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_operations.py index 2cb91715878..4438956a3f3 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_operations.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,7 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +123,7 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_operations.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_operations.py index 26c399a3075..8d54bcaafe1 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_operations.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload from my.library import CustomDefaultPollingMethod, CustomPager, CustomPoller @@ -74,7 +74,7 @@ def build_polling_paging_example_basic_paging_request(**kwargs: Any) -> HttpRequ class PollingPagingExampleOperationsMixin(PollingPagingExampleMixinABC): def _basic_polling_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +295,7 @@ def basic_paging(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_operations.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_operations.py index 5f876c4b724..71253813252 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_operations.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from my.library.aio import AsyncCustomDefaultPollingMethod, AsyncCustomPager, AsyncCustomPoller @@ -47,7 +47,7 @@ class PollingPagingExampleOperationsMixin(PollingPagingExampleMixinABC): async def _basic_polling_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -272,7 +272,7 @@ def basic_paging(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py index 04b4cc79ac7..ee0912a5af5 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py index 4c6272fe51b..8d073da10e7 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py index d8845436937..4be9f4faa37 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +113,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +265,7 @@ async def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -332,7 +337,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -367,7 +372,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -449,7 +454,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py index b6829b16820..690f2856ffb 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_one_operations import build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py index 276c2b825d6..f8c3e856901 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +190,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +339,7 @@ def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +411,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +446,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -523,7 +528,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py index 8f7c9b12331..9a1698f1e80 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py index ad661be89c2..5a0be7edf6a 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_one_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) :rtype: ~azure.multiapi.sample.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py index 86a890c0f98..60a12c78568 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ...operations._operation_group_one_operations import build_test_three_request, build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,7 @@ async def test_two( :rtype: ~azure.multiapi.sample.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py index 21714a8c1ba..4319a9592b6 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/aio/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_two_operations import build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py index ea91f521292..c5eb192672d 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo :rtype: ~azure.multiapi.sample.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py index 2e0a4eaf6f2..966f69141c4 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_two( :rtype: ~azure.multiapi.sample.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +210,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py index 32ac9cc48e7..b6b3ebd461a 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v2/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py index 093967add65..3607f228970 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,6 +35,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ def test_paging(self, **kwargs: Any) -> AsyncIterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -85,7 +90,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -138,7 +143,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py index 8419407a4ac..3c1c3e5b565 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +77,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> AsyncIterable["_models.M cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +186,7 @@ async def test_two( :rtype: ~azure.multiapi.sample.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py index 5ae779bff82..ffaf7a29d00 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/aio/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ...operations._operation_group_two_operations import build_test_five_request, build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py index 4ca564c9352..573fcbb01a2 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -100,7 +105,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,7 +132,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -180,7 +185,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py index f294b7c31dd..6be2c244390 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +111,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +220,7 @@ def test_two( :rtype: ~azure.multiapi.sample.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py index ce2102fc0a8..dc2e7f1a577 100644 --- a/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/samples/specification/multiapi/generated/azure/multiapi/sample/v3/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -142,7 +147,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +207,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py index 8cf6a45c024..5a6fdc953fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_duration_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_put_positive_duration_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +119,7 @@ async def put_positive_duration( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py index d0e415561a5..97fec1d0745 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -120,7 +125,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +176,7 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +224,7 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +271,7 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py index cdf7c7bb5b8..db72dc2daf6 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_parameter_grouping_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ build_post_shared_parameter_group_object_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ async def post_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -138,7 +143,7 @@ async def post_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +204,7 @@ async def post_reserved_words( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,7 +268,7 @@ async def post_multi_param_groups( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +330,7 @@ async def post_shared_parameter_group_object( # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -381,7 +386,7 @@ async def group_with_constant( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py index 3d14f7c97f9..7fdc047cb9f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -217,7 +222,7 @@ def post_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -284,7 +289,7 @@ def post_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -345,7 +350,7 @@ def post_reserved_words( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +414,7 @@ def post_multi_param_groups( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -471,7 +476,7 @@ def post_shared_parameter_group_object( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -527,7 +532,7 @@ def group_with_constant( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py index ada92ea07be..e45d0fccf60 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_auto_rest_report_service_for_azure_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ...operations._auto_rest_report_service_for_azure_operations import build_get_report_request from .._vendor import AutoRestReportServiceForAzureMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Di :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py index 49c78ccae27..e8c3b400d90 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import AutoRestReportServiceForAzureMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +72,7 @@ def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py index addf22e970a..a0d06bbb4af 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_default_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_get_swagger_global_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def get_method_global_not_provided_valid( # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,7 +160,7 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +205,7 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py index 1a34c5a817d..986313069c4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_api_version_local_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_get_swagger_local_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +118,7 @@ async def get_method_local_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +207,7 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py index ff7213e1fa2..999f39840b4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_header_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_custom_named_request_id_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ async def custom_named_request_id( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +125,7 @@ async def custom_named_request_id_param_grouping( # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -173,7 +178,7 @@ async def custom_named_request_id_head(self, foo_client_request_id: str, **kwarg :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py index 34741250f3a..1ba19532d36 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_odata_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._odata_operations import build_get_with_filter_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,7 @@ async def get_with_filter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py index 8aaffa6ae43..0e7e7aaa732 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_skip_url_encoding_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -35,6 +36,10 @@ build_get_swagger_query_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,7 @@ async def get_method_path_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +123,7 @@ async def get_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,7 +216,7 @@ async def get_method_query_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +264,7 @@ async def get_method_query_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,7 +312,7 @@ async def get_path_query_valid( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +356,7 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py index a927a4abc10..218d4209d13 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_credentials_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ build_post_swagger_global_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ async def post_method_global_not_provided_valid( # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -204,7 +209,7 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -249,7 +254,7 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py index 590d251cae6..362238e6721 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_subscription_in_method_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ build_post_swagger_local_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +73,7 @@ async def post_method_local_valid( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +123,7 @@ async def post_method_local_null( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +173,7 @@ async def post_path_local_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +223,7 @@ async def post_swagger_local_valid( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py index 86fa8696408..949fd5feee5 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_xms_client_request_id_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._xms_client_request_id_operations import build_get_request, build_param_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +111,7 @@ async def param_get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py index 401e5c65b84..b4d6d1b7813 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -139,7 +144,7 @@ def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +191,7 @@ def get_method_global_not_provided_valid( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +236,7 @@ def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,7 +281,7 @@ def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py index 22548a99d5e..cac5ebb2995 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +142,7 @@ def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,7 +192,7 @@ def get_method_local_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +236,7 @@ def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,7 +281,7 @@ def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py index 1fd1aa93a7e..3f4da7ff52a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -114,7 +119,7 @@ def custom_named_request_id( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +174,7 @@ def custom_named_request_id_param_grouping( # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ def custom_named_request_id_head(self, foo_client_request_id: str, **kwargs: Any :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py index a0134ac10f5..13a8ca41309 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -95,7 +100,7 @@ def get_with_filter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py index f116964a6d9..85f1ca15ff0 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,7 +202,7 @@ def get_method_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +250,7 @@ def get_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +294,7 @@ def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,7 +341,7 @@ def get_method_query_valid(self, q1: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -384,7 +389,7 @@ def get_method_query_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +435,7 @@ def get_path_query_valid(self, q1: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -474,7 +479,7 @@ def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py index eda76376aed..dd010c7a06a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -178,7 +183,7 @@ def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +228,7 @@ def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,7 +275,7 @@ def post_method_global_not_provided_valid( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +322,7 @@ def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -362,7 +367,7 @@ def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py index 1d47c5fc206..9805b798275 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -153,7 +158,7 @@ def post_method_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +208,7 @@ def post_method_local_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -253,7 +258,7 @@ def post_path_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +308,7 @@ def post_swagger_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py index 271fc242a71..21ffcb7dd60 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +137,7 @@ def param_get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py index 31254481a52..9bc8bf896e1 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._paths_operations import build_get_empty_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def get_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py index 75be5c6e196..470325040a6 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,7 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py index 1e83eb3116c..0e84264ad4f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_paging_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast import urllib.parse from custompollerpagerdefinitions.aio import AsyncCustomPager, AsyncCustomPoller @@ -61,6 +62,10 @@ build_replace_api_version_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +102,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable["_models.Produc cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,7 +175,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +248,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable["_models cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -316,7 +321,7 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable["_models.Product"]: cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -394,7 +399,7 @@ def get_single_pages_with_body_params( content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +477,7 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable["_models.Product" cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +560,7 @@ def get_multiple_pages( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +646,7 @@ def get_with_query_params(self, required_query_parameter: int, **kwargs: Any) -> query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -714,7 +719,7 @@ def duplicate_params(self, filter: Optional[str] = None, **kwargs: Any) -> Async cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -793,7 +798,7 @@ def page_with_max_page_size( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -877,7 +882,7 @@ def get_odata_multiple_pages( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -968,7 +973,7 @@ def get_multiple_pages_with_offset( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1053,7 +1058,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1127,7 +1132,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable["_mode cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1200,7 +1205,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.Prod cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1273,7 +1278,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.Pr cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1346,7 +1351,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1425,7 +1430,7 @@ def get_multiple_pages_fragment_next_link( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1500,7 +1505,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1574,7 +1579,7 @@ async def _get_multiple_pages_lro_initial( paging_get_multiple_pages_lro_options: Optional[_models.PagingGetMultiplePagesLroOptions] = None, **kwargs: Any ) -> _models.ProductResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1647,7 +1652,7 @@ async def begin_get_multiple_pages_lro( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1767,7 +1772,7 @@ def append_api_version(self, **kwargs: Any) -> AsyncIterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1843,7 +1848,7 @@ def replace_api_version(self, **kwargs: Any) -> AsyncIterable["_models.Product"] api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1920,7 +1925,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[_models.ProductResultValueWithXMSClientName] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py index e72dc5d0639..8d7a3989cc1 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_paging_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Iterable, Literal, Optional, Type, TypeVar, Union, cast import urllib.parse from custompollerpagerdefinitions import CustomPager, CustomPoller @@ -33,6 +34,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -558,7 +563,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -631,7 +636,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -704,7 +709,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable["_models.Prod cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -777,7 +782,7 @@ def get_single_pages(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -855,7 +860,7 @@ def get_single_pages_with_body_params( content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -933,7 +938,7 @@ def first_response_empty(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1016,7 +1021,7 @@ def get_multiple_pages( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1102,7 +1107,7 @@ def get_with_query_params(self, required_query_parameter: int, **kwargs: Any) -> query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1175,7 +1180,7 @@ def duplicate_params(self, filter: Optional[str] = None, **kwargs: Any) -> Itera cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1252,7 +1257,7 @@ def page_with_max_page_size(self, maxpagesize: Literal["5"] = "5", **kwargs: Any cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1336,7 +1341,7 @@ def get_odata_multiple_pages( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1427,7 +1432,7 @@ def get_multiple_pages_with_offset( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1512,7 +1517,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1586,7 +1591,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable["_models.Pr cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1659,7 +1664,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> Iterable["_models.Product"] cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1732,7 +1737,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable["_models.Product cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1805,7 +1810,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1884,7 +1889,7 @@ def get_multiple_pages_fragment_next_link( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1959,7 +1964,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2033,7 +2038,7 @@ def _get_multiple_pages_lro_initial( paging_get_multiple_pages_lro_options: Optional[_models.PagingGetMultiplePagesLroOptions] = None, **kwargs: Any, ) -> _models.ProductResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2106,7 +2111,7 @@ def begin_get_multiple_pages_lro( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2226,7 +2231,7 @@ def append_api_version(self, **kwargs: Any) -> Iterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2302,7 +2307,7 @@ def replace_api_version(self, **kwargs: Any) -> Iterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2379,7 +2384,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[_models.ProductResultValueWithXMSClientName] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py index 5c3d7dec02e..71dae3aa12e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_paging_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ build_get_pages_partial_url_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +74,7 @@ def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterab cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +146,7 @@ def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> A cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py index c2ec1f152d4..bc025caaffa 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -118,7 +123,7 @@ def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> Iterable["_ cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +195,7 @@ def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> I cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py index 5c5654284ee..94925145ff3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py index 9ea1355ee8b..98be09f4ec4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py index 12934e99002..46fbb451345 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_head_exception_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._head_exception_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py index 669f9c19292..7f00fc61a4f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py index 86859510c13..89fb466a342 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py index 70c9f5c87ea..62e1f00a3a3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py index 95e6b9871f9..04b650bb614 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lr_os_custom_header_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -35,6 +36,10 @@ build_put_async_retry_succeeded_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +66,7 @@ def __init__(self, *args, **kwargs) -> None: async def _put_async_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +236,7 @@ def get_long_running_output(pipeline_response): async def _put201_creating_succeeded200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,7 +395,7 @@ def get_long_running_output(pipeline_response): async def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -535,7 +540,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py index 109dd1644ae..c475f62b94e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lro_retrys_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -38,6 +39,10 @@ build_put_async_relative_retry_succeeded_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ def __init__(self, *args, **kwargs) -> None: async def _put201_creating_succeeded200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,7 +225,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -387,7 +392,7 @@ def get_long_running_output(pipeline_response): async def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +490,7 @@ def get_long_running_output(pipeline_response): async def _delete202_retry200_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -567,7 +572,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,7 +659,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -796,7 +801,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py index acc60c7ca59..74fbde0894b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lros_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -75,6 +76,10 @@ build_put_sub_resource_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -101,7 +106,7 @@ def __init__(self, *args, **kwargs) -> None: async def _put200_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +257,7 @@ def get_long_running_output(pipeline_response): async def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +417,7 @@ def get_long_running_output(pipeline_response): async def _patch201_retry_with_async_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +575,7 @@ def get_long_running_output(pipeline_response): async def _patch202_retry_with_async_and_location_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -729,7 +734,7 @@ def get_long_running_output(pipeline_response): async def _put201_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -876,7 +881,7 @@ def get_long_running_output(pipeline_response): ) async def _post202_list_initial(self, **kwargs: Any) -> Optional[List[_models.Product]]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -972,7 +977,7 @@ def get_long_running_output(pipeline_response): async def _put200_succeeded_no_state_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1121,7 +1126,7 @@ def get_long_running_output(pipeline_response): async def _put202_retry200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1273,7 +1278,7 @@ def get_long_running_output(pipeline_response): async def _put201_creating_succeeded200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1429,7 +1434,7 @@ def get_long_running_output(pipeline_response): async def _put200_updating_succeeded204_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1581,7 +1586,7 @@ def get_long_running_output(pipeline_response): async def _put201_creating_failed200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1737,7 +1742,7 @@ def get_long_running_output(pipeline_response): async def _put200_acceptedcanceled200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1889,7 +1894,7 @@ def get_long_running_output(pipeline_response): async def _put_no_header_in_retry_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2045,7 +2050,7 @@ def get_long_running_output(pipeline_response): async def _put_async_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2212,7 +2217,7 @@ def get_long_running_output(pipeline_response): async def _put_async_no_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2377,7 +2382,7 @@ def get_long_running_output(pipeline_response): async def _put_async_retry_failed_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2544,7 +2549,7 @@ def get_long_running_output(pipeline_response): async def _put_async_no_retrycanceled_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2709,7 +2714,7 @@ def get_long_running_output(pipeline_response): async def _put_async_no_header_in_retry_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2872,7 +2877,7 @@ def get_long_running_output(pipeline_response): async def _put_non_resource_initial( self, sku: Optional[Union[_models.Sku, IO[bytes]]] = None, **kwargs: Any ) -> _models.Sku: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3009,7 +3014,7 @@ def get_long_running_output(pipeline_response): async def _put_async_non_resource_initial( self, sku: Optional[Union[_models.Sku, IO[bytes]]] = None, **kwargs: Any ) -> _models.Sku: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3146,7 +3151,7 @@ def get_long_running_output(pipeline_response): async def _put_sub_resource_initial( self, provisioning_state: Optional[str] = None, **kwargs: Any ) -> _models.SubProduct: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3251,7 +3256,7 @@ def get_long_running_output(pipeline_response): async def _put_async_sub_resource_initial( self, provisioning_state: Optional[str] = None, **kwargs: Any ) -> _models.SubProduct: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3356,7 +3361,7 @@ def get_long_running_output(pipeline_response): async def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3454,7 +3459,7 @@ def get_long_running_output(pipeline_response): async def _delete_provisioning202_deleting_failed200_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3552,7 +3557,7 @@ def get_long_running_output(pipeline_response): async def _delete_provisioning202_deletingcanceled200_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3650,7 +3655,7 @@ def get_long_running_output(pipeline_response): async def _delete204_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3725,7 +3730,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3817,7 +3822,7 @@ def get_long_running_output(pipeline_response): ) async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3911,7 +3916,7 @@ def get_long_running_output(pipeline_response): async def _delete_no_header_in_retry_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3993,7 +3998,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_no_header_in_retry_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4075,7 +4080,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4160,7 +4165,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_no_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4245,7 +4250,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_retry_failed_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4330,7 +4335,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_retrycanceled_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4413,7 +4418,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _post200_with_payload_initial(self, **kwargs: Any) -> _models.Sku: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4503,7 +4508,7 @@ def get_long_running_output(pipeline_response): async def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4645,7 +4650,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_no_retry204_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4803,7 +4808,7 @@ def get_long_running_output(pipeline_response): async def _post_double_headers_final_location_get_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4895,7 +4900,7 @@ def get_long_running_output(pipeline_response): async def _post_double_headers_final_azure_header_get_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4988,7 +4993,7 @@ def get_long_running_output(pipeline_response): async def _post_double_headers_final_azure_header_get_default_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5078,7 +5083,7 @@ def get_long_running_output(pipeline_response): async def _post_async_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5240,7 +5245,7 @@ def get_long_running_output(pipeline_response): async def _post_async_no_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5402,7 +5407,7 @@ def get_long_running_output(pipeline_response): async def _post_async_retry_failed_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5550,7 +5555,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_retrycanceled_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py index 8b1aab02718..775cd7fd02e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_lrosads_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -57,6 +58,10 @@ build_put_non_retry400_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ def __init__(self, *args, **kwargs) -> None: async def _put_non_retry400_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -233,7 +238,7 @@ def get_long_running_output(pipeline_response): async def _put_non_retry201_creating400_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +391,7 @@ def get_long_running_output(pipeline_response): async def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -539,7 +544,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry400_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,7 +708,7 @@ def get_long_running_output(pipeline_response): async def _delete_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -784,7 +789,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete202_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +870,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry400_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -950,7 +955,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1094,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1228,7 +1233,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1373,7 +1378,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _put_error201_no_provisioning_state_payload_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1523,7 +1528,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_no_status_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1690,7 +1695,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_no_status_payload_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1857,7 +1862,7 @@ def get_long_running_output(pipeline_response): async def _delete204_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1934,7 +1939,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry_no_status_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2021,7 +2026,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_no_location_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2163,7 +2168,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry_no_payload_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2311,7 +2316,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _put200_invalid_json_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2462,7 +2467,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_invalid_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2629,7 +2634,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_invalid_json_polling_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2796,7 +2801,7 @@ def get_long_running_output(pipeline_response): async def _delete202_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2878,7 +2883,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2965,7 +2970,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry_invalid_json_polling_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3052,7 +3057,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3194,7 +3199,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3342,7 +3347,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry_invalid_json_polling_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py index d1af26a78d0..2dbe4d19c52 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -127,7 +132,7 @@ def __init__(self, *args, **kwargs): def _put_async_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,7 +299,7 @@ def get_long_running_output(pipeline_response): def _put201_creating_succeeded200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +455,7 @@ def get_long_running_output(pipeline_response): def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -595,7 +600,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py index 0433a089686..b859de72de2 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -171,7 +176,7 @@ def __init__(self, *args, **kwargs): def _put201_creating_succeeded200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +329,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +493,7 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,7 +588,7 @@ def get_long_running_output(pipeline_response): ) def _delete202_retry200_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -665,7 +670,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -752,7 +757,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -894,7 +899,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py index e1345ce233f..7919b651f09 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -768,7 +773,7 @@ def __init__(self, *args, **kwargs): def _put200_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -916,7 +921,7 @@ def get_long_running_output(pipeline_response): def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1073,7 +1078,7 @@ def get_long_running_output(pipeline_response): def _patch201_retry_with_async_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1227,7 +1232,7 @@ def get_long_running_output(pipeline_response): def _patch202_retry_with_async_and_location_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1383,7 +1388,7 @@ def get_long_running_output(pipeline_response): def _put201_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1527,7 +1532,7 @@ def get_long_running_output(pipeline_response): ) def _post202_list_initial(self, **kwargs: Any) -> Optional[List[_models.Product]]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1621,7 +1626,7 @@ def get_long_running_output(pipeline_response): def _put200_succeeded_no_state_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1767,7 +1772,7 @@ def get_long_running_output(pipeline_response): def _put202_retry200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1916,7 +1921,7 @@ def get_long_running_output(pipeline_response): def _put201_creating_succeeded200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2069,7 +2074,7 @@ def get_long_running_output(pipeline_response): def _put200_updating_succeeded204_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2218,7 +2223,7 @@ def get_long_running_output(pipeline_response): def _put201_creating_failed200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2371,7 +2376,7 @@ def get_long_running_output(pipeline_response): def _put200_acceptedcanceled200_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2520,7 +2525,7 @@ def get_long_running_output(pipeline_response): def _put_no_header_in_retry_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2673,7 +2678,7 @@ def get_long_running_output(pipeline_response): def _put_async_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2837,7 +2842,7 @@ def get_long_running_output(pipeline_response): def _put_async_no_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2999,7 +3004,7 @@ def get_long_running_output(pipeline_response): def _put_async_retry_failed_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3163,7 +3168,7 @@ def get_long_running_output(pipeline_response): def _put_async_no_retrycanceled_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3325,7 +3330,7 @@ def get_long_running_output(pipeline_response): def _put_async_no_header_in_retry_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3485,7 +3490,7 @@ def get_long_running_output(pipeline_response): def _put_non_resource_initial( self, sku: Optional[Union[_models.Sku, IO[bytes]]] = None, **kwargs: Any ) -> _models.Sku: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3620,7 +3625,7 @@ def get_long_running_output(pipeline_response): def _put_async_non_resource_initial( self, sku: Optional[Union[_models.Sku, IO[bytes]]] = None, **kwargs: Any ) -> _models.Sku: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3753,7 +3758,7 @@ def get_long_running_output(pipeline_response): return LROPoller[_models.Sku](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put_sub_resource_initial(self, provisioning_state: Optional[str] = None, **kwargs: Any) -> _models.SubProduct: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3857,7 +3862,7 @@ def get_long_running_output(pipeline_response): def _put_async_sub_resource_initial( self, provisioning_state: Optional[str] = None, **kwargs: Any ) -> _models.SubProduct: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3961,7 +3966,7 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4058,7 +4063,7 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_deleting_failed200_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4155,7 +4160,7 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_deletingcanceled200_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4250,7 +4255,7 @@ def get_long_running_output(pipeline_response): ) def _delete204_succeeded_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4325,7 +4330,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4416,7 +4421,7 @@ def get_long_running_output(pipeline_response): ) def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4509,7 +4514,7 @@ def get_long_running_output(pipeline_response): def _delete_no_header_in_retry_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4591,7 +4596,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_no_header_in_retry_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4673,7 +4678,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4758,7 +4763,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_no_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4843,7 +4848,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_retry_failed_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4928,7 +4933,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_retrycanceled_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5011,7 +5016,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _post200_with_payload_initial(self, **kwargs: Any) -> _models.Sku: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5099,7 +5104,7 @@ def get_long_running_output(pipeline_response): def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5241,7 +5246,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_no_retry204_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5396,7 +5401,7 @@ def get_long_running_output(pipeline_response): def _post_double_headers_final_location_get_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5487,7 +5492,7 @@ def get_long_running_output(pipeline_response): def _post_double_headers_final_azure_header_get_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5578,7 +5583,7 @@ def get_long_running_output(pipeline_response): def _post_double_headers_final_azure_header_get_default_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5667,7 +5672,7 @@ def get_long_running_output(pipeline_response): def _post_async_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5826,7 +5831,7 @@ def get_long_running_output(pipeline_response): def _post_async_no_retry_succeeded_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5985,7 +5990,7 @@ def get_long_running_output(pipeline_response): def _post_async_retry_failed_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6133,7 +6138,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_retrycanceled_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py index b1784df6546..b650cbd4233 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -495,7 +500,7 @@ def __init__(self, *args, **kwargs): def _put_non_retry400_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -642,7 +647,7 @@ def get_long_running_output(pipeline_response): def _put_non_retry201_creating400_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -792,7 +797,7 @@ def get_long_running_output(pipeline_response): def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -942,7 +947,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry400_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1101,7 +1106,7 @@ def get_long_running_output(pipeline_response): ) def _delete_non_retry400_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1180,7 +1185,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete202_non_retry400_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1261,7 +1266,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry400_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1346,7 +1351,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1485,7 +1490,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1624,7 +1629,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1769,7 +1774,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _put_error201_no_provisioning_state_payload_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1916,7 +1921,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_no_status_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2080,7 +2085,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_no_status_payload_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2242,7 +2247,7 @@ def get_long_running_output(pipeline_response): ) def _delete204_succeeded_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2319,7 +2324,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry_no_status_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2406,7 +2411,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_no_location_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2548,7 +2553,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry_no_payload_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2696,7 +2701,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _put200_invalid_json_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2844,7 +2849,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_invalid_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3008,7 +3013,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_invalid_json_polling_initial( # pylint: disable=name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> _models.Product: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3172,7 +3177,7 @@ def get_long_running_output(pipeline_response): def _delete202_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3254,7 +3259,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3341,7 +3346,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry_invalid_json_polling_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3428,7 +3433,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3570,7 +3575,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3718,7 +3723,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry_invalid_json_polling_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py index 4b76c8922c2..9246f97979a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_lro_with_paramaterized_endpoints_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ ) from .._vendor import LROWithParamaterizedEndpointsMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ class LROWithParamaterizedEndpointsOperationsMixin( # pylint: disable=name-too- async def _poll_with_parameterized_endpoints_initial( # pylint: disable=name-too-long self, account_name: str, **kwargs: Any ) -> Optional[str]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +155,7 @@ def get_long_running_output(pipeline_response): async def _poll_with_constant_parameterized_endpoints_initial( # pylint: disable=name-too-long self, account_name: str, **kwargs: Any ) -> Optional[str]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py index 2a8704fbfd3..50f2b3ae1f1 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_lro_with_paramaterized_endpoints_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import LROWithParamaterizedEndpointsMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,7 @@ class LROWithParamaterizedEndpointsOperationsMixin( # pylint: disable=name-too- def _poll_with_parameterized_endpoints_initial( # pylint: disable=name-too-long self, account_name: str, **kwargs: Any ) -> Optional[str]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +191,7 @@ def get_long_running_output(pipeline_response): def _poll_with_constant_parameterized_endpoints_initial( # pylint: disable=name-too-long self, account_name: str, **kwargs: Any ) -> Optional[str]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_default_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_default_operations.py index 089c2f733a5..3f9a9d2e839 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_default_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_default_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ build_get_swagger_global_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +67,7 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def get_method_global_not_provided_valid( # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,7 +159,7 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +204,7 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_local_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_local_operations.py index 06dab121b51..2beb2f5ce0b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_local_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_api_version_local_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ build_get_swagger_local_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +67,7 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ async def get_method_local_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -156,7 +161,7 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +206,7 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_header_operations.py index 3240a41140f..528f936a3ae 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_header_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_custom_named_request_id_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def custom_named_request_id( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -119,7 +124,7 @@ async def custom_named_request_id_param_grouping( # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,7 +179,7 @@ async def custom_named_request_id_head( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_http_success_operations.py index 54ff818e206..2808803f711 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,7 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +103,7 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_odata_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_odata_operations.py index e0f24b3e578..53c0cd26163 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_odata_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_odata_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._odata_operations import build_get_with_filter_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ async def get_with_filter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_skip_url_encoding_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_skip_url_encoding_operations.py index 5f02dc9d163..4dcb37af03f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_skip_url_encoding_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_skip_url_encoding_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +35,10 @@ build_get_swagger_query_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +74,7 @@ async def get_method_path_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +122,7 @@ async def get_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +215,7 @@ async def get_method_query_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +263,7 @@ async def get_method_query_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +311,7 @@ async def get_path_query_valid( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +355,7 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_credentials_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_credentials_operations.py index 7bac90f04d0..9c10b057d99 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_credentials_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_credentials_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_post_swagger_global_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -156,7 +161,7 @@ async def post_method_global_not_provided_valid( # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +208,7 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +253,7 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_method_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_method_operations.py index 90614098990..7857393831f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_method_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_subscription_in_method_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_post_swagger_local_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +72,7 @@ async def post_method_local_valid( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +122,7 @@ async def post_method_local_null( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +172,7 @@ async def post_path_local_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -217,7 +222,7 @@ async def post_swagger_local_valid( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_xms_client_request_id_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_xms_client_request_id_operations.py index 2fae30c1030..81f18ab37d4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_xms_client_request_id_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_xms_client_request_id_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._xms_client_request_id_operations import build_get_request, build_param_get_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +62,7 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +110,7 @@ async def param_get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_default_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_default_operations.py index d9e855ae4ac..1d077ad1916 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_default_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_default_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -138,7 +143,7 @@ def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +190,7 @@ def get_method_global_not_provided_valid( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,7 +235,7 @@ def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +280,7 @@ def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_local_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_local_operations.py index 324aca991b7..54a597fa090 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_local_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_api_version_local_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -136,7 +141,7 @@ def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +191,7 @@ def get_method_local_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,7 +235,7 @@ def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +280,7 @@ def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_header_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_header_operations.py index ca5a4c11c9c..2034a1fc6bb 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_header_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_header_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -113,7 +118,7 @@ def custom_named_request_id( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +173,7 @@ def custom_named_request_id_param_grouping( # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +228,7 @@ def custom_named_request_id_head( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_http_success_operations.py index 9645177297e..6070dfedbff 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,7 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,7 +127,7 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_odata_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_odata_operations.py index d0330613d05..da80e8d4734 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_odata_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_odata_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +99,7 @@ def get_with_filter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_skip_url_encoding_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_skip_url_encoding_operations.py index 759d5e987e8..166265cf45e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_skip_url_encoding_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_skip_url_encoding_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +201,7 @@ def get_method_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +249,7 @@ def get_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +293,7 @@ def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +340,7 @@ def get_method_query_valid(self, q1: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +388,7 @@ def get_method_query_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,7 +434,7 @@ def get_path_query_valid(self, q1: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,7 +478,7 @@ def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_credentials_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_credentials_operations.py index 46b782f2bc3..41712bb5cb3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_credentials_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_credentials_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -177,7 +182,7 @@ def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +274,7 @@ def post_method_global_not_provided_valid( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -316,7 +321,7 @@ def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +366,7 @@ def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_method_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_method_operations.py index fd0be4895c1..b22920040f2 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_method_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_subscription_in_method_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -152,7 +157,7 @@ def post_method_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +207,7 @@ def post_method_local_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +257,7 @@ def post_path_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +307,7 @@ def post_swagger_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_xms_client_request_id_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_xms_client_request_id_operations.py index c699ea47eab..5df3f7f5ef3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_xms_client_request_id_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_xms_client_request_id_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +136,7 @@ def param_get( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_http_success_operations.py index 692c99ba562..e03dacc816a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_http_success_operations.py index 966b699c6c1..9fbfa6fa61d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_paging_operations.py index cbcf3551598..cd3af171811 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_paging_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -59,6 +60,10 @@ build_replace_api_version_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,7 +100,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable["_models.Produc cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +173,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,7 +246,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable["_models cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +319,7 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable["_models.Product"]: cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -392,7 +397,7 @@ def get_single_pages_with_body_params( content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +475,7 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable["_models.Product" cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -553,7 +558,7 @@ def get_multiple_pages( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,7 +644,7 @@ def get_with_query_params(self, required_query_parameter: int, **kwargs: Any) -> query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -712,7 +717,7 @@ def duplicate_params(self, filter: Optional[str] = None, **kwargs: Any) -> Async cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -791,7 +796,7 @@ def page_with_max_page_size( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -875,7 +880,7 @@ def get_odata_multiple_pages( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -966,7 +971,7 @@ def get_multiple_pages_with_offset( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1051,7 +1056,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1125,7 +1130,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable["_mode cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1198,7 +1203,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.Prod cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1276,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.Pr cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1344,7 +1349,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1423,7 +1428,7 @@ def get_multiple_pages_fragment_next_link( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1498,7 +1503,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1572,7 +1577,7 @@ async def _get_multiple_pages_lro_initial( paging_get_multiple_pages_lro_options: Optional[_models.PagingGetMultiplePagesLroOptions] = None, **kwargs: Any ) -> _models.ProductResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1645,7 +1650,7 @@ async def begin_get_multiple_pages_lro( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1765,7 +1770,7 @@ def append_api_version(self, **kwargs: Any) -> AsyncIterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1841,7 +1846,7 @@ def replace_api_version(self, **kwargs: Any) -> AsyncIterable["_models.Product"] api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1918,7 +1923,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[_models.ProductResultValueWithXMSClientName] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_paging_operations.py index 1b377a19a3c..35da9c7b5e8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_paging_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Iterable, Literal, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -31,6 +32,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -556,7 +561,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +634,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -702,7 +707,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable["_models.Prod cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +780,7 @@ def get_single_pages(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -853,7 +858,7 @@ def get_single_pages_with_body_params( content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -931,7 +936,7 @@ def first_response_empty(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1014,7 +1019,7 @@ def get_multiple_pages( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1105,7 @@ def get_with_query_params(self, required_query_parameter: int, **kwargs: Any) -> query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1173,7 +1178,7 @@ def duplicate_params(self, filter: Optional[str] = None, **kwargs: Any) -> Itera cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1250,7 +1255,7 @@ def page_with_max_page_size(self, maxpagesize: Literal["5"] = "5", **kwargs: Any cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1334,7 +1339,7 @@ def get_odata_multiple_pages( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1425,7 +1430,7 @@ def get_multiple_pages_with_offset( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1510,7 +1515,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1584,7 +1589,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable["_models.Pr cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1657,7 +1662,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> Iterable["_models.Product"] cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1730,7 +1735,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable["_models.Product cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1803,7 +1808,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1882,7 +1887,7 @@ def get_multiple_pages_fragment_next_link( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1957,7 +1962,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2031,7 +2036,7 @@ def _get_multiple_pages_lro_initial( paging_get_multiple_pages_lro_options: Optional[_models.PagingGetMultiplePagesLroOptions] = None, **kwargs: Any, ) -> _models.ProductResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2104,7 +2109,7 @@ def begin_get_multiple_pages_lro( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2224,7 +2229,7 @@ def append_api_version(self, **kwargs: Any) -> Iterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2300,7 +2305,7 @@ def replace_api_version(self, **kwargs: Any) -> Iterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2377,7 +2382,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[_models.ProductResultValueWithXMSClientName] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_http_success_operations.py index 58a41dbfe7f..3a7ef30639c 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py index 74b8228b8c4..0b647071971 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_http_success_operations.py index b07fb47e264..ea673e144aa 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py index 485f9a55895..7b831170305 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_http_success_operations.py index 421db1a86b3..7345730f265 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._http_success_operations import build_head200_request, build_head204_request, build_head404_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py index ead31a48f00..4d659f5cbfc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py index ce844f9123d..e8585ae3b2e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, AsyncIterable, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -58,6 +59,10 @@ build_replace_api_version_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +99,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable["_models.Produc cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +172,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,7 +245,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable["_models cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +318,7 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable["_models.Product"]: cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -391,7 +396,7 @@ def get_single_pages_with_body_params( content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +474,7 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable["_models.Product" cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -551,7 +556,7 @@ def get_multiple_pages( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -637,7 +642,7 @@ def get_with_query_params(self, required_query_parameter: int, **kwargs: Any) -> query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -710,7 +715,7 @@ def duplicate_params(self, filter: Optional[str] = None, **kwargs: Any) -> Async cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -789,7 +794,7 @@ def page_with_max_page_size( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -873,7 +878,7 @@ def get_odata_multiple_pages( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -964,7 +969,7 @@ def get_multiple_pages_with_offset( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1049,7 +1054,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1123,7 +1128,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable["_mode cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1196,7 +1201,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.Prod cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1269,7 +1274,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable["_models.Pr cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1342,7 +1347,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable["_model cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1421,7 +1426,7 @@ def get_multiple_pages_fragment_next_link( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1496,7 +1501,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1570,7 +1575,7 @@ async def _get_multiple_pages_lro_initial( paging_get_multiple_pages_lro_options: Optional[_models.PagingGetMultiplePagesLroOptions] = None, **kwargs: Any ) -> _models.ProductResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1642,7 +1647,7 @@ async def begin_get_multiple_pages_lro( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1762,7 +1767,7 @@ def append_api_version(self, **kwargs: Any) -> AsyncIterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1838,7 +1843,7 @@ def replace_api_version(self, **kwargs: Any) -> AsyncIterable["_models.Product"] api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1915,7 +1920,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[_models.ProductResultValueWithXMSClientName] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py index b2666e6beff..c8ff50015b0 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Iterable, Literal, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -555,7 +560,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -628,7 +633,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,7 +706,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable["_models.Prod cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +779,7 @@ def get_single_pages(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -852,7 +857,7 @@ def get_single_pages_with_body_params( content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -930,7 +935,7 @@ def first_response_empty(self, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models.ProductResultValue] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1012,7 +1017,7 @@ def get_multiple_pages( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1098,7 +1103,7 @@ def get_with_query_params(self, required_query_parameter: int, **kwargs: Any) -> query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1171,7 +1176,7 @@ def duplicate_params(self, filter: Optional[str] = None, **kwargs: Any) -> Itera cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1248,7 +1253,7 @@ def page_with_max_page_size(self, maxpagesize: Literal["5"] = "5", **kwargs: Any cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1332,7 +1337,7 @@ def get_odata_multiple_pages( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1423,7 +1428,7 @@ def get_multiple_pages_with_offset( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1508,7 +1513,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1582,7 +1587,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable["_models.Pr cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1655,7 +1660,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> Iterable["_models.Product"] cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1728,7 +1733,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable["_models.Product cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1801,7 +1806,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable["_models.Pro cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1880,7 +1885,7 @@ def get_multiple_pages_fragment_next_link( cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1955,7 +1960,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[_models.OdataProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2029,7 +2034,7 @@ def _get_multiple_pages_lro_initial( paging_get_multiple_pages_lro_options: Optional[_models.PagingGetMultiplePagesLroOptions] = None, **kwargs: Any, ) -> _models.ProductResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2100,7 +2105,7 @@ def begin_get_multiple_pages_lro( cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2220,7 +2225,7 @@ def append_api_version(self, **kwargs: Any) -> Iterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2296,7 +2301,7 @@ def replace_api_version(self, **kwargs: Any) -> Iterable["_models.Product"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProductResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2373,7 +2378,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[_models.ProductResultValueWithXMSClientName] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py index 615642c578c..92c20a9e065 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ...operations._autorest_security_aad_operations import build_head_request from .._vendor import AutorestSecurityAadMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,7 @@ async def head(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py index 991bbbbf080..bfd0c0adc28 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import AutorestSecurityAadMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def head(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py index 9217c692d89..26729e1fd25 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ...operations._autorest_security_key_operations import build_head_request from .._vendor import AutorestSecurityKeyMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,7 @@ async def head(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py index 469841dc2f8..b3bde172271 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import AutorestSecurityKeyMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def head(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py index 0c277fc1416..4b3b57c7890 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -43,6 +44,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -121,7 +126,7 @@ async def check_name_availability( :rtype: ~storage.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +186,7 @@ async def _create_initial( parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.StorageAccount]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +400,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -453,7 +458,7 @@ async def get_properties( :rtype: ~storage.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -599,7 +604,7 @@ async def update( :rtype: ~storage.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +672,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~storage.models.StorageAccountKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -725,7 +730,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +812,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +898,7 @@ async def regenerate_key( :rtype: ~storage.models.StorageAccountKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py index 0b855a9d3d7..986b796cd9e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_usage_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._usage_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def list(self, **kwargs: Any) -> _models.UsageListResult: :rtype: ~storage.models.UsageListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py index e30ac5e835c..466733ac72b 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -383,7 +388,7 @@ def check_name_availability( :rtype: ~storage.models.CheckNameAvailabilityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +448,7 @@ def _create_initial( parameters: Union[_models.StorageAccountCreateParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.StorageAccount]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -657,7 +662,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -713,7 +718,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~storage.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -859,7 +864,7 @@ def update( :rtype: ~storage.models.StorageAccount :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -927,7 +932,7 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~storage.models.StorageAccountKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -985,7 +990,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.StorageAccount"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1065,7 +1070,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageAccountListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1151,7 +1156,7 @@ def regenerate_key( :rtype: ~storage.models.StorageAccountKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py index 15d81afe33c..68e1a8cc7b7 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ def list(self, **kwargs: Any) -> _models.UsageListResult: :rtype: ~storage.models.UsageListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py index 188b6781891..e533d6035a9 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_group_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._group_operations import build_get_sample_resource_group_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An :rtype: ~subscriptionidapiversion.models.SampleResourceGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py index bd93cb139e2..5648a2b2d1a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +95,7 @@ def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> :rtype: ~subscriptionidapiversion.models.SampleResourceGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py index f3a1522cd5a..d83541e2e02 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_duration_put_positive_duration_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ async def put_positive_duration( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +165,7 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +215,7 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py index aa142ccb3fd..50e1d1adc5d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +122,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +176,7 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +224,7 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +274,7 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py index 599ad773e92..eb1b86f8e63 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_parameter_grouping_post_shared_parameter_group_object_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +74,7 @@ async def post_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +131,7 @@ async def post_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,7 +184,7 @@ async def post_reserved_words( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,7 +245,7 @@ async def post_multi_param_groups( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -293,7 +298,7 @@ async def post_shared_parameter_group_object( # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +356,7 @@ async def group_with_constant( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py index 0bbb14b654e..55bc152f6f4 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -211,7 +216,7 @@ def post_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +273,7 @@ def post_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +326,7 @@ def post_reserved_words( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -382,7 +387,7 @@ def post_multi_param_groups( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +440,7 @@ def post_shared_parameter_group_object( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -493,7 +498,7 @@ def group_with_constant( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py index 4014b81bfa1..07138767872 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import AutoRestReportServiceForAzureMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,7 @@ def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[ "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py index d1dc88cdfa2..070e13c9c75 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_auto_rest_report_service_for_azure_get_report_request from .._vendor import AutoRestReportServiceForAzureMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,7 @@ async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py index 4b37f7a1406..a098ecfa90c 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -55,6 +56,10 @@ build_xms_client_request_id_param_get_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -129,7 +134,7 @@ async def param_get(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +196,7 @@ async def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +241,7 @@ async def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,7 +288,7 @@ async def post_method_global_not_provided_valid( # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +334,7 @@ async def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -374,7 +379,7 @@ async def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +447,7 @@ async def post_method_local_valid( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +497,7 @@ async def post_method_local_null( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +547,7 @@ async def post_path_local_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -592,7 +597,7 @@ async def post_swagger_local_valid( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,7 +659,7 @@ async def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -700,7 +705,7 @@ async def get_method_global_not_provided_valid( # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -744,7 +749,7 @@ async def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -788,7 +793,7 @@ async def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -850,7 +855,7 @@ async def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -900,7 +905,7 @@ async def get_method_local_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -944,7 +949,7 @@ async def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -989,7 +994,7 @@ async def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1056,7 +1061,7 @@ async def get_method_path_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1104,7 +1109,7 @@ async def get_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1148,7 +1153,7 @@ async def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1197,7 +1202,7 @@ async def get_method_query_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1245,7 +1250,7 @@ async def get_method_query_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1293,7 +1298,7 @@ async def get_path_query_valid( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1337,7 +1342,7 @@ async def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1409,7 +1414,7 @@ async def get_with_filter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1477,7 +1482,7 @@ async def custom_named_request_id( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1529,7 +1534,7 @@ async def custom_named_request_id_param_grouping( # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1578,7 +1583,7 @@ async def custom_named_request_id_head(self, *, foo_client_request_id: str, **kw :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py index f03b484973b..fa4bd0f7291 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -662,7 +667,7 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -706,7 +711,7 @@ def param_get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +773,7 @@ def post_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -813,7 +818,7 @@ def post_method_global_null(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -860,7 +865,7 @@ def post_method_global_not_provided_valid( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -906,7 +911,7 @@ def post_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -951,7 +956,7 @@ def post_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1019,7 +1024,7 @@ def post_method_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1069,7 +1074,7 @@ def post_method_local_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1124,7 @@ def post_path_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1169,7 +1174,7 @@ def post_swagger_local_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1231,7 +1236,7 @@ def get_method_global_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1277,7 +1282,7 @@ def get_method_global_not_provided_valid( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1321,7 +1326,7 @@ def get_path_global_valid(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1365,7 +1370,7 @@ def get_swagger_global_valid(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1427,7 +1432,7 @@ def get_method_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1477,7 +1482,7 @@ def get_method_local_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1521,7 +1526,7 @@ def get_path_local_valid(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1566,7 +1571,7 @@ def get_swagger_local_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1633,7 +1638,7 @@ def get_method_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1681,7 +1686,7 @@ def get_path_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1725,7 +1730,7 @@ def get_swagger_path_valid(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1774,7 +1779,7 @@ def get_method_query_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1822,7 +1827,7 @@ def get_method_query_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1868,7 +1873,7 @@ def get_path_query_valid(self, *, q1: str, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1912,7 +1917,7 @@ def get_swagger_query_valid(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1984,7 +1989,7 @@ def get_with_filter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2052,7 +2057,7 @@ def custom_named_request_id( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2104,7 +2109,7 @@ def custom_named_request_id_param_grouping( # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2153,7 +2158,7 @@ def custom_named_request_id_head(self, *, foo_client_request_id: str, **kwargs: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py index 23c7fca12d0..37d9c210da9 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from ...operations._operations import build_paths_get_empty_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +60,7 @@ async def get_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py index 35874fd4028..c70f52c14d4 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py index 57fe4f21100..b37c8ce9c0a 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from custompollerpagerdefinitions.aio import AsyncCustomPager, AsyncCustomPoller @@ -110,7 +110,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,7 +194,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +278,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -362,7 +362,7 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -516,7 +516,7 @@ def get_single_pages_with_body_params( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -611,7 +611,7 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -703,7 +703,7 @@ def get_multiple_pages( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -794,7 +794,7 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -878,7 +878,7 @@ def duplicate_params(self, *, filter: Optional[str] = None, **kwargs: Any) -> As cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -964,7 +964,7 @@ def page_with_max_page_size(self, **kwargs: Any) -> AsyncIterable[JSON]: maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1057,7 +1057,7 @@ def get_odata_multiple_pages( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1153,7 +1153,7 @@ def get_multiple_pages_with_offset( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1241,7 +1241,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1326,7 +1326,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1410,7 +1410,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1494,7 +1494,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1578,7 +1578,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1668,7 +1668,7 @@ def get_multiple_pages_fragment_next_link( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1756,7 +1756,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1817,7 +1817,7 @@ async def get_next(next_link=None): async def _get_multiple_pages_lro_initial( self, *, maxresults: Optional[int] = None, timeout: int = 30, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1895,7 +1895,7 @@ async def begin_get_multiple_pages_lro( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2019,7 +2019,7 @@ def append_api_version(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2105,7 +2105,7 @@ def replace_api_version(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2193,7 +2193,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py index 87c8dfeeaeb..be8fa89b982 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from custompollerpagerdefinitions import CustomPager, CustomPoller @@ -566,7 +566,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -650,7 +650,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -734,7 +734,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -818,7 +818,7 @@ def get_single_pages(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -970,7 +970,7 @@ def get_single_pages_with_body_params(self, parameters: Union[JSON, IO[bytes]], content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1065,7 +1065,7 @@ def first_response_empty(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1157,7 +1157,7 @@ def get_multiple_pages( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1248,7 +1248,7 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1332,7 +1332,7 @@ def duplicate_params(self, *, filter: Optional[str] = None, **kwargs: Any) -> It cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1418,7 +1418,7 @@ def page_with_max_page_size(self, **kwargs: Any) -> Iterable[JSON]: maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1511,7 +1511,7 @@ def get_odata_multiple_pages( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1607,7 +1607,7 @@ def get_multiple_pages_with_offset( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1695,7 +1695,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1780,7 +1780,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1864,7 +1864,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1948,7 +1948,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2032,7 +2032,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2120,7 +2120,7 @@ def get_multiple_pages_fragment_next_link(self, tenant: str, *, api_version: str cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2208,7 +2208,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2269,7 +2269,7 @@ def get_next(next_link=None): def _get_multiple_pages_lro_initial( self, *, maxresults: Optional[int] = None, timeout: int = 30, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2346,7 +2346,7 @@ def begin_get_multiple_pages_lro( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2470,7 +2470,7 @@ def append_api_version(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2556,7 +2556,7 @@ def replace_api_version(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2644,7 +2644,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py index 3d59ef5cf90..17bc33b2505 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> AsyncIterab cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +164,7 @@ def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> A cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py index 3f9f61179bc..c66c6ae9529 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -130,7 +130,7 @@ def get_pages_partial_url(self, account_name: str, **kwargs: Any) -> Iterable[JS cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +213,7 @@ def get_pages_partial_url_operation(self, account_name: str, **kwargs: Any) -> I cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py index 888118a4c5b..e72f2fb00c2 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ build_head_exception_head404_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +105,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +149,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py index 8e0d0015cc6..c7c6d4f860b 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +125,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py index 7e891dc667c..292294369cd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ build_http_success_head404_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,7 @@ async def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +105,7 @@ async def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +149,7 @@ async def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py index a01d4a7e44c..6cc2b767b51 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,7 @@ def head200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +125,7 @@ def head204(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_operations.py index 4fa0fa93d79..ed88685e517 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -188,7 +188,7 @@ def get_qnas( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +257,7 @@ async def get_next(next_link=None): async def _update_qnas_initial( self, project_name: str, body: Union[List[JSON], IO[bytes]], **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -730,7 +730,7 @@ async def begin_update_qnas( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_operations.py index 29d9ef9c328..26c4767ca14 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -256,7 +256,7 @@ def get_qnas( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +325,7 @@ def get_next(next_link=None): def _update_qnas_initial( self, project_name: str, body: Union[List[JSON], IO[bytes]], **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -798,7 +798,7 @@ def begin_update_qnas( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py index ab23651d130..3c9ec1d3274 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -139,7 +139,7 @@ def __init__(self, *args, **kwargs) -> None: async def _put200_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,7 +390,7 @@ def get_long_running_output(pipeline_response): async def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +649,7 @@ def get_long_running_output(pipeline_response): async def _patch201_retry_with_async_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -910,7 +910,7 @@ def get_long_running_output(pipeline_response): async def _patch202_retry_with_async_and_location_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1170,7 +1170,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _put201_succeeded_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1417,7 +1417,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _post202_list_initial(self, **kwargs: Any) -> Optional[List[JSON]]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1543,7 +1543,7 @@ def get_long_running_output(pipeline_response): async def _put200_succeeded_no_state_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1790,7 +1790,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _put202_retry200_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2042,7 +2042,7 @@ def get_long_running_output(pipeline_response): async def _put201_creating_succeeded200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2301,7 +2301,7 @@ def get_long_running_output(pipeline_response): async def _put200_updating_succeeded204_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2553,7 +2553,7 @@ def get_long_running_output(pipeline_response): async def _put201_creating_failed200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2812,7 +2812,7 @@ def get_long_running_output(pipeline_response): async def _put200_acceptedcanceled200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3064,7 +3064,7 @@ def get_long_running_output(pipeline_response): async def _put_no_header_in_retry_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3319,7 +3319,7 @@ def get_long_running_output(pipeline_response): async def _put_async_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3585,7 +3585,7 @@ def get_long_running_output(pipeline_response): async def _put_async_no_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3849,7 +3849,7 @@ def get_long_running_output(pipeline_response): async def _put_async_retry_failed_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4115,7 +4115,7 @@ def get_long_running_output(pipeline_response): async def _put_async_no_retrycanceled_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4379,7 +4379,7 @@ def get_long_running_output(pipeline_response): async def _put_async_no_header_in_retry_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4639,7 +4639,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _put_non_resource_initial(self, sku: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4821,7 +4821,7 @@ def get_long_running_output(pipeline_response): async def _put_async_non_resource_initial( self, sku: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5001,7 +5001,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _put_sub_resource_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5217,7 +5217,7 @@ def get_long_running_output(pipeline_response): async def _put_async_sub_resource_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5433,7 +5433,7 @@ def get_long_running_output(pipeline_response): async def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5560,7 +5560,7 @@ def get_long_running_output(pipeline_response): async def _delete_provisioning202_deleting_failed200_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5687,7 +5687,7 @@ def get_long_running_output(pipeline_response): async def _delete_provisioning202_deletingcanceled200_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5814,7 +5814,7 @@ def get_long_running_output(pipeline_response): async def _delete204_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5890,7 +5890,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6008,7 +6008,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6128,7 +6128,7 @@ def get_long_running_output(pipeline_response): async def _delete_no_header_in_retry_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6211,7 +6211,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_no_header_in_retry_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6294,7 +6294,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6380,7 +6380,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_no_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6466,7 +6466,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_retry_failed_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6552,7 +6552,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_retrycanceled_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6636,7 +6636,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _post200_with_payload_initial(self, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6744,7 +6744,7 @@ def get_long_running_output(pipeline_response): async def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6929,7 +6929,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_no_retry204_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7186,7 +7186,7 @@ def get_long_running_output(pipeline_response): async def _post_double_headers_final_location_get_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7304,7 +7304,7 @@ def get_long_running_output(pipeline_response): async def _post_double_headers_final_azure_header_get_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7423,7 +7423,7 @@ def get_long_running_output(pipeline_response): async def _post_double_headers_final_azure_header_get_default_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7539,7 +7539,7 @@ def get_long_running_output(pipeline_response): async def _post_async_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7801,7 +7801,7 @@ def get_long_running_output(pipeline_response): async def _post_async_no_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8063,7 +8063,7 @@ def get_long_running_output(pipeline_response): async def _post_async_retry_failed_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8254,7 +8254,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_retrycanceled_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8463,7 +8463,7 @@ def __init__(self, *args, **kwargs) -> None: async def _put201_creating_succeeded200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8722,7 +8722,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8988,7 +8988,7 @@ def get_long_running_output(pipeline_response): async def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9115,7 +9115,7 @@ def get_long_running_output(pipeline_response): async def _delete202_retry200_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9198,7 +9198,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9286,7 +9286,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9471,7 +9471,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9678,7 +9678,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _put_non_retry400_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9931,7 +9931,7 @@ def get_long_running_output(pipeline_response): async def _put_non_retry201_creating400_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10187,7 +10187,7 @@ def get_long_running_output(pipeline_response): async def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10443,7 +10443,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry400_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10706,7 +10706,7 @@ def get_long_running_output(pipeline_response): async def _delete_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10788,7 +10788,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete202_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10870,7 +10870,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry400_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10956,7 +10956,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11138,7 +11138,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11320,7 +11320,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11508,7 +11508,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _put_error201_no_provisioning_state_payload_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11761,7 +11761,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_no_status_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12027,7 +12027,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_no_status_payload_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12293,7 +12293,7 @@ def get_long_running_output(pipeline_response): async def _delete204_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12371,7 +12371,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry_no_status_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12459,7 +12459,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_no_location_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12644,7 +12644,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry_no_payload_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12835,7 +12835,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _put200_invalid_json_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13086,7 +13086,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_invalid_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13352,7 +13352,7 @@ def get_long_running_output(pipeline_response): async def _put_async_relative_retry_invalid_json_polling_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13618,7 +13618,7 @@ def get_long_running_output(pipeline_response): async def _delete202_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13701,7 +13701,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13789,7 +13789,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _delete_async_relative_retry_invalid_json_polling_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13877,7 +13877,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post202_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14062,7 +14062,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14253,7 +14253,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_relative_retry_invalid_json_polling_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14462,7 +14462,7 @@ def __init__(self, *args, **kwargs) -> None: async def _put_async_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14731,7 +14731,7 @@ def get_long_running_output(pipeline_response): async def _put201_creating_succeeded200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14993,7 +14993,7 @@ def get_long_running_output(pipeline_response): async def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -15181,7 +15181,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def _post_async_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py index 055f7039f36..fb74dd2a254 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -1407,7 +1407,7 @@ def __init__(self, *args, **kwargs): def _put200_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1658,7 +1658,7 @@ def get_long_running_output(pipeline_response): def _patch200_succeeded_ignore_headers_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1917,7 +1917,7 @@ def get_long_running_output(pipeline_response): def _patch201_retry_with_async_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2177,7 +2177,7 @@ def get_long_running_output(pipeline_response): def _patch202_retry_with_async_and_location_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2437,7 +2437,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put201_succeeded_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2684,7 +2684,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _post202_list_initial(self, **kwargs: Any) -> Optional[List[JSON]]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2806,7 +2806,7 @@ def get_long_running_output(pipeline_response): def _put200_succeeded_no_state_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3053,7 +3053,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put202_retry200_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3303,7 +3303,7 @@ def get_long_running_output(pipeline_response): def _put201_creating_succeeded200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3562,7 +3562,7 @@ def get_long_running_output(pipeline_response): def _put200_updating_succeeded204_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3814,7 +3814,7 @@ def get_long_running_output(pipeline_response): def _put201_creating_failed200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4073,7 +4073,7 @@ def get_long_running_output(pipeline_response): def _put200_acceptedcanceled200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4323,7 +4323,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put_no_header_in_retry_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4578,7 +4578,7 @@ def get_long_running_output(pipeline_response): def _put_async_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4844,7 +4844,7 @@ def get_long_running_output(pipeline_response): def _put_async_no_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5106,7 +5106,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put_async_retry_failed_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5372,7 +5372,7 @@ def get_long_running_output(pipeline_response): def _put_async_no_retrycanceled_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5636,7 +5636,7 @@ def get_long_running_output(pipeline_response): def _put_async_no_header_in_retry_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5896,7 +5896,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put_non_resource_initial(self, sku: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6074,7 +6074,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put_async_non_resource_initial(self, sku: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6254,7 +6254,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put_sub_resource_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6468,7 +6468,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _put_async_sub_resource_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6684,7 +6684,7 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6811,7 +6811,7 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_deleting_failed200_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6938,7 +6938,7 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_deletingcanceled200_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7063,7 +7063,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete204_succeeded_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7139,7 +7139,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete202_retry200_initial(self, **kwargs: Any) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7257,7 +7257,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete202_no_retry204_initial(self, **kwargs: Any) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7377,7 +7377,7 @@ def get_long_running_output(pipeline_response): def _delete_no_header_in_retry_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7460,7 +7460,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_no_header_in_retry_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7543,7 +7543,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7629,7 +7629,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_no_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7715,7 +7715,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_retry_failed_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7801,7 +7801,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_retrycanceled_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7885,7 +7885,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _post200_with_payload_initial(self, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7993,7 +7993,7 @@ def get_long_running_output(pipeline_response): def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8176,7 +8176,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _post202_no_retry204_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8431,7 +8431,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _post_double_headers_final_location_get_initial(self, **kwargs: Any) -> JSON: # pylint: disable=name-too-long - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8549,7 +8549,7 @@ def get_long_running_output(pipeline_response): def _post_double_headers_final_azure_header_get_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8667,7 +8667,7 @@ def get_long_running_output(pipeline_response): def _post_double_headers_final_azure_header_get_default_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8783,7 +8783,7 @@ def get_long_running_output(pipeline_response): def _post_async_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9045,7 +9045,7 @@ def get_long_running_output(pipeline_response): def _post_async_no_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9307,7 +9307,7 @@ def get_long_running_output(pipeline_response): def _post_async_retry_failed_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9498,7 +9498,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_retrycanceled_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9707,7 +9707,7 @@ def __init__(self, *args, **kwargs): def _put201_creating_succeeded200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9966,7 +9966,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_succeeded_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10232,7 +10232,7 @@ def get_long_running_output(pipeline_response): def _delete_provisioning202_accepted200_succeeded_initial( # pylint: disable=name-too-long self, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10357,7 +10357,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete202_retry200_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10440,7 +10440,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10528,7 +10528,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10713,7 +10713,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10920,7 +10920,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _put_non_retry400_initial(self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11173,7 +11173,7 @@ def get_long_running_output(pipeline_response): def _put_non_retry201_creating400_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11429,7 +11429,7 @@ def get_long_running_output(pipeline_response): def _put_non_retry201_creating400_invalid_json_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11685,7 +11685,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry400_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11946,7 +11946,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete_non_retry400_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12026,7 +12026,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete202_non_retry400_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12108,7 +12108,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry400_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12194,7 +12194,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12376,7 +12376,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_non_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12558,7 +12558,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry400_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12746,7 +12746,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _put_error201_no_provisioning_state_payload_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -12999,7 +12999,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_no_status_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13265,7 +13265,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_no_status_payload_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13529,7 +13529,7 @@ def get_long_running_output(pipeline_response): return LROPoller[JSON](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _delete204_succeeded_initial(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13607,7 +13607,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry_no_status_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13695,7 +13695,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_no_location_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -13880,7 +13880,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry_no_payload_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14071,7 +14071,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _put200_invalid_json_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14322,7 +14322,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_invalid_header_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14588,7 +14588,7 @@ def get_long_running_output(pipeline_response): def _put_async_relative_retry_invalid_json_polling_initial( # pylint: disable=name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14854,7 +14854,7 @@ def get_long_running_output(pipeline_response): def _delete202_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -14937,7 +14937,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -15025,7 +15025,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _delete_async_relative_retry_invalid_json_polling_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -15113,7 +15113,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post202_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -15298,7 +15298,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry_invalid_header_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -15489,7 +15489,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_relative_retry_invalid_json_polling_initial( # pylint: disable=inconsistent-return-statements,name-too-long self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -15698,7 +15698,7 @@ def __init__(self, *args, **kwargs): def _put_async_retry_succeeded_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -15967,7 +15967,7 @@ def get_long_running_output(pipeline_response): def _put201_creating_succeeded200_initial( self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -16229,7 +16229,7 @@ def get_long_running_output(pipeline_response): def _post202_retry200_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -16417,7 +16417,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def _post_async_retry_succeeded_initial( # pylint: disable=inconsistent-return-statements self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py index daf148b8b0c..5915ad48f0f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import LROWithParamaterizedEndpointsMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,7 @@ class LROWithParamaterizedEndpointsOperationsMixin( # pylint: disable=name-too- def _poll_with_parameterized_endpoints_initial( # pylint: disable=name-too-long self, account_name: str, **kwargs: Any ) -> Optional[str]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +198,7 @@ def get_long_running_output(pipeline_response): def _poll_with_constant_parameterized_endpoints_initial( # pylint: disable=name-too-long self, account_name: str, **kwargs: Any ) -> Optional[str]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py index 2ea3a8a0b46..2410d645c54 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union, cast +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ ) from .._vendor import LROWithParamaterizedEndpointsMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ class LROWithParamaterizedEndpointsOperationsMixin( # pylint: disable=name-too- async def _poll_with_parameterized_endpoints_initial( # pylint: disable=name-too-long self, account_name: str, **kwargs: Any ) -> Optional[str]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,7 +159,7 @@ def get_long_running_output(pipeline_response): async def _poll_with_constant_parameterized_endpoints_initial( # pylint: disable=name-too-long self, account_name: str, **kwargs: Any ) -> Optional[str]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py index 73a3fd728c9..6315722dcc6 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -107,7 +107,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +191,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +275,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +359,7 @@ def get_single_pages(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,7 +513,7 @@ def get_single_pages_with_body_params( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -608,7 +608,7 @@ def first_response_empty(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -700,7 +700,7 @@ def get_multiple_pages( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -791,7 +791,7 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -875,7 +875,7 @@ def duplicate_params(self, *, filter: Optional[str] = None, **kwargs: Any) -> As cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,7 +961,7 @@ def page_with_max_page_size(self, **kwargs: Any) -> AsyncIterable[JSON]: maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1054,7 +1054,7 @@ def get_odata_multiple_pages( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1150,7 +1150,7 @@ def get_multiple_pages_with_offset( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1238,7 +1238,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1323,7 +1323,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1407,7 +1407,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1491,7 +1491,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1575,7 +1575,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1665,7 +1665,7 @@ def get_multiple_pages_fragment_next_link( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1753,7 +1753,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1814,7 +1814,7 @@ async def get_next(next_link=None): async def _get_multiple_pages_lro_initial( self, *, maxresults: Optional[int] = None, timeout: int = 30, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1891,7 +1891,7 @@ async def begin_get_multiple_pages_lro( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2015,7 +2015,7 @@ def append_api_version(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2101,7 +2101,7 @@ def replace_api_version(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2189,7 +2189,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py index 1966a5c1071..ddf399701c4 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -563,7 +563,7 @@ def get_no_item_name_pages(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -647,7 +647,7 @@ def get_empty_next_link_name_pages(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,7 +731,7 @@ def get_null_next_link_name_pages(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -815,7 +815,7 @@ def get_single_pages(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -967,7 +967,7 @@ def get_single_pages_with_body_params(self, parameters: Union[JSON, IO[bytes]], content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1062,7 +1062,7 @@ def first_response_empty(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1154,7 +1154,7 @@ def get_multiple_pages( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1245,7 +1245,7 @@ def get_with_query_params(self, *, required_query_parameter: int, **kwargs: Any) query_constant: Literal[True] = kwargs.pop("query_constant", _params.pop("queryConstant", True)) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1329,7 +1329,7 @@ def duplicate_params(self, *, filter: Optional[str] = None, **kwargs: Any) -> It cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1415,7 +1415,7 @@ def page_with_max_page_size(self, **kwargs: Any) -> Iterable[JSON]: maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1508,7 +1508,7 @@ def get_odata_multiple_pages( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1604,7 +1604,7 @@ def get_multiple_pages_with_offset( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1692,7 +1692,7 @@ def get_multiple_pages_retry_first(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1777,7 +1777,7 @@ def get_multiple_pages_retry_second(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1861,7 +1861,7 @@ def get_single_pages_failure(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1945,7 +1945,7 @@ def get_multiple_pages_failure(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2029,7 +2029,7 @@ def get_multiple_pages_failure_uri(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2117,7 +2117,7 @@ def get_multiple_pages_fragment_next_link(self, tenant: str, *, api_version: str cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2205,7 +2205,7 @@ def get_multiple_pages_fragment_with_grouping_next_link( # pylint: disable=name cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2266,7 +2266,7 @@ def get_next(next_link=None): def _get_multiple_pages_lro_initial( self, *, maxresults: Optional[int] = None, timeout: int = 30, **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2343,7 +2343,7 @@ def begin_get_multiple_pages_lro( cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2467,7 +2467,7 @@ def append_api_version(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2553,7 +2553,7 @@ def replace_api_version(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2641,7 +2641,7 @@ def get_paging_model_with_item_name_with_xms_client_name( # pylint: disable=nam cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py index 1abe01aa609..b1e84570072 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -178,7 +178,7 @@ async def check_name_availability(self, account_name: Union[JSON, IO[bytes]], ** Known values are: "AccountNameInvalid" and "AlreadyExists". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +237,7 @@ async def check_name_availability(self, account_name: Union[JSON, IO[bytes]], ** async def _create_initial( self, resource_group_name: str, account_name: str, parameters: Union[JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -692,7 +692,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -819,7 +819,7 @@ async def get_properties(self, resource_group_name: str, account_name: str, **kw "type": "str" # Optional. Resource type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1226,7 +1226,7 @@ async def update( "type": "str" # Optional. Resource type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1306,7 +1306,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: "key2": "str" # Optional. Gets the value of key 2. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1437,7 +1437,7 @@ def list(self, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1587,7 +1587,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1765,7 +1765,7 @@ async def regenerate_key( "key2": "str" # Optional. Gets the value of key 2. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1874,7 +1874,7 @@ async def list(self, **kwargs: Any) -> JSON: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py index 55263a6b212..11f9bb49c75 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -446,7 +446,7 @@ def check_name_availability(self, account_name: Union[JSON, IO[bytes]], **kwargs Known values are: "AccountNameInvalid" and "AlreadyExists". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +505,7 @@ def check_name_availability(self, account_name: Union[JSON, IO[bytes]], **kwargs def _create_initial( self, resource_group_name: str, account_name: str, parameters: Union[JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -960,7 +960,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1087,7 +1087,7 @@ def get_properties(self, resource_group_name: str, account_name: str, **kwargs: "type": "str" # Optional. Resource type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1494,7 +1494,7 @@ def update( "type": "str" # Optional. Resource type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1574,7 +1574,7 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) "key2": "str" # Optional. Gets the value of key 2. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1705,7 +1705,7 @@ def list(self, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1855,7 +1855,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2033,7 +2033,7 @@ def regenerate_key( "key2": "str" # Optional. Gets the value of key 2. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2142,7 +2142,7 @@ def list(self, **kwargs: Any) -> JSON: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py index ab312fcce0d..accd245063f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -69,7 +69,7 @@ async def get_sample_resource_group(self, resource_group_name: str, **kwargs: An "name": "str" # Optional. resource group name 'testgroup101'. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py index 07a3d7b2ced..fd694f035a9 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -100,7 +100,7 @@ def get_sample_resource_group(self, resource_group_name: str, **kwargs: Any) -> "name": "str" # Optional. resource group name 'testgroup101'. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_operations.py index 393d37e6383..5fbcd1575ee 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -142,7 +142,7 @@ def get_model(self, mode: str, **kwargs: Any) -> JSON: "received": "str" # Required. Known values are: "raw" and "model". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +273,7 @@ def post_model(self, mode: str, input: Union[JSON, IO[bytes]], **kwargs: Any) -> "received": "str" # Required. Known values are: "raw" and "model". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -354,7 +354,7 @@ def get_pages(self, mode: str, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +405,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) def _lro_initial(self, mode: str, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_operations.py index b0154e3c3a2..13a900df0d4 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -66,7 +66,7 @@ async def get_model(self, mode: str, **kwargs: Any) -> JSON: "received": "str" # Required. Known values are: "raw" and "model". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +201,7 @@ async def post_model(self, mode: str, input: Union[JSON, IO[bytes]], **kwargs: A "received": "str" # Required. Known values are: "raw" and "model". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -282,7 +282,7 @@ def get_pages(self, mode: str, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +333,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) async def _lro_initial(self, mode: str, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_operations.py index 393d37e6383..5fbcd1575ee 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -142,7 +142,7 @@ def get_model(self, mode: str, **kwargs: Any) -> JSON: "received": "str" # Required. Known values are: "raw" and "model". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +273,7 @@ def post_model(self, mode: str, input: Union[JSON, IO[bytes]], **kwargs: Any) -> "received": "str" # Required. Known values are: "raw" and "model". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -354,7 +354,7 @@ def get_pages(self, mode: str, **kwargs: Any) -> Iterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +405,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) def _lro_initial(self, mode: str, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_operations.py index b0154e3c3a2..13a900df0d4 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -66,7 +66,7 @@ async def get_model(self, mode: str, **kwargs: Any) -> JSON: "received": "str" # Required. Known values are: "raw" and "model". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +201,7 @@ async def post_model(self, mode: str, input: Union[JSON, IO[bytes]], **kwargs: A "received": "str" # Required. Known values are: "raw" and "model". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -282,7 +282,7 @@ def get_pages(self, mode: str, **kwargs: Any) -> AsyncIterable[JSON]: cls: ClsType[JSON] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +333,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) async def _lro_initial(self, mode: str, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_operations.py index 938e6a648e2..39d9dc9b78a 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -66,7 +66,7 @@ async def head_no_params(self, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +120,7 @@ async def get_required(self, *, parameter: str, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +178,7 @@ async def put_required_optional( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +281,7 @@ async def post_parameters(self, parameter: Union[JSON, IO[bytes]], **kwargs: Any "url": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +347,7 @@ async def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_operations.py index b99164decdf..a2acbadc0b6 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -153,7 +153,7 @@ def head_no_params(self, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +207,7 @@ def get_required(self, *, parameter: str, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -265,7 +265,7 @@ def put_required_optional( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -366,7 +366,7 @@ def post_parameters(self, parameter: Union[JSON, IO[bytes]], **kwargs: Any) -> J "url": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +432,7 @@ def get_optional(self, *, optional_param: Optional[str] = None, **kwargs: Any) - :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_operations.py index 4fccaf7208b..f7bc2fa3526 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -70,7 +70,7 @@ async def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,7 +127,7 @@ async def get_required(self, *, parameter: str, new_parameter: Optional[str] = N :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +193,7 @@ async def put_required_optional( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +295,7 @@ async def post_parameters(self, parameter: Union[JSON, IO[bytes]], **kwargs: Any "url": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +364,7 @@ async def delete_parameters(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +415,7 @@ async def get_optional( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +469,7 @@ async def get_new_operation(self, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_operations.py index 01242c81ee1..4c0b7d5ade7 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -191,7 +191,7 @@ def head_no_params(self, *, new_parameter: Optional[str] = None, **kwargs: Any) :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +248,7 @@ def get_required(self, *, parameter: str, new_parameter: Optional[str] = None, * :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +314,7 @@ def put_required_optional( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -416,7 +416,7 @@ def post_parameters(self, parameter: Union[JSON, IO[bytes]], **kwargs: Any) -> J "url": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +485,7 @@ def delete_parameters(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +536,7 @@ def get_optional( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +590,7 @@ def get_new_operation(self, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_operations.py index d5db413b1e4..677ed3e7b4b 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import DPGClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -129,7 +134,7 @@ def get_model(self, mode: str, **kwargs: Any) -> _models.Product: :rtype: ~dpgtestmodelsversiontolerant.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +232,7 @@ def post_model(self, mode: str, input: Union[_models.Input, IO[bytes]], **kwargs :rtype: ~dpgtestmodelsversiontolerant.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +302,7 @@ def get_pages(self, mode: str, **kwargs: Any) -> Iterable["_models.Product"]: cls: ClsType[_models._models.ProductResult] = kwargs.pop("cls", None) # pylint: disable=protected-access - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +355,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) def _lro_initial(self, mode: str, **kwargs: Any) -> _models.LROProduct: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_operations.py index 7463d326c97..4cb94a05c23 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ ) from .._vendor import DPGClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ async def get_model(self, mode: str, **kwargs: Any) -> _models.Product: :rtype: ~dpgtestmodelsversiontolerant.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +156,7 @@ async def post_model(self, mode: str, input: Union[_models.Input, IO[bytes]], ** :rtype: ~dpgtestmodelsversiontolerant.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +226,7 @@ def get_pages(self, mode: str, **kwargs: Any) -> AsyncIterable["_models.Product" cls: ClsType[_models._models.ProductResult] = kwargs.pop("cls", None) # pylint: disable=protected-access - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +279,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) async def _lro_initial(self, mode: str, **kwargs: Any) -> _models.LROProduct: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py index 6445faeb326..5bc31690d4d 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._operation_group_one_operations import build_test_two_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py index 665f6aa2821..d68184a3893 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v0/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py index 1256e5e3255..1072d2c37f2 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +113,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +265,7 @@ async def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -332,7 +337,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +454,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py index c0b379ea225..d091d89086f 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_one_operations import build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py index 91f4fb726e3..52fdeab10df 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +190,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +339,7 @@ def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +411,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -523,7 +528,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py index a6b35b8a566..9e4c7aa9d09 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py index bf8be225bc6..7e9a2481aab 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_one_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) :rtype: ~multiapi.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py index aa663f03f77..d52dad91367 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ...operations._operation_group_one_operations import build_test_three_request, build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,7 @@ async def test_two( :rtype: ~multiapi.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py index 90148e3c5a2..b56ceb3f3d8 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_two_operations import build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py index 89fbbeee332..7c0d921e97f 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo :rtype: ~multiapi.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py index 3302efeb90c..07f77dc295a 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_two( :rtype: ~multiapi.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +210,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py index 664d8181393..2a5ccbd4a31 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py index b67966c1973..49ffba0daf7 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,6 +35,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ def test_paging(self, **kwargs: Any) -> AsyncIterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -138,7 +143,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py index 733fb276c35..f9c7cfd3931 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +77,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> AsyncIterable["_models.M cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +186,7 @@ async def test_two( :rtype: ~multiapi.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py index dfb54848e6e..4ed262f8a20 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ...operations._operation_group_two_operations import build_test_five_request, build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py index d9bdab5ae43..c0606063c12 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -100,7 +105,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py index 1486e341856..72a3e8e6ca8 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +111,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +220,7 @@ def test_two( :rtype: ~multiapi.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py index ae6217015e1..db36404219b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -142,7 +147,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +207,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py index a7708c0d3da..1c5045af84a 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +113,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +265,7 @@ async def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +338,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +455,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py index c33301de2f2..2c7b51cbd16 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_one_operations import build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py index 6cd3347f988..453d1e9a701 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +190,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +339,7 @@ def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +412,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -524,7 +529,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py index 376adf5130a..dd30113fffc 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py index 951bdff528c..185a63cd51e 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_one_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) :rtype: ~multiapicredentialdefaultpolicy.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py index a0ec75442c4..e69e20bee2a 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ...operations._operation_group_one_operations import build_test_three_request, build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,7 @@ async def test_two( :rtype: ~multiapicredentialdefaultpolicy.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py index 234a059ee0c..8de23e0ad26 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/aio/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_two_operations import build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py index b237e6c7aa6..59900fc2413 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo :rtype: ~multiapicredentialdefaultpolicy.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py index d01664d34e6..f684a4a1fde 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_two( :rtype: ~multiapicredentialdefaultpolicy.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +210,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py index e29ed27e469..e1f1adb7a03 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v2/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py index 017eee71170..31ec5724871 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,6 +35,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ def test_paging(self, **kwargs: Any) -> AsyncIterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +144,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py index 060759ee5e4..3feab7cebb8 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> AsyncIterable["_models.M cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +187,7 @@ async def test_two( :rtype: ~multiapicredentialdefaultpolicy.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py index 0c3bf028336..dde3040ce50 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/aio/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ...operations._operation_group_two_operations import build_test_five_request, build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py index 35844b18428..e3f947ceef7 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -100,7 +105,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py index a876e15fe12..b5d51c45e71 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +111,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +220,7 @@ def test_two( :rtype: ~multiapicredentialdefaultpolicy.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py index 6d4d62c3961..9a2c801c161 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCredentialDefaultPolicy/multiapicredentialdefaultpolicy/v3/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -142,7 +147,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +207,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py index 02f2dda3c4f..5da1edaade7 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/aio/operations/_multiapi_custom_base_url_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._multiapi_custom_base_url_service_client_operations import build_test_request from .._vendor import MultiapiCustomBaseUrlServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ async def test(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py index def8e3e6cd6..1156b1266d8 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v1/operations/_multiapi_custom_base_url_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiCustomBaseUrlServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,7 @@ def test(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py index 848f0624bbc..ed43663199d 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/aio/operations/_multiapi_custom_base_url_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._multiapi_custom_base_url_service_client_operations import build_test_request from .._vendor import MultiapiCustomBaseUrlServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ async def test(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py index efc6bba8675..e6d93c9a4a2 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiCustomBaseUrl/multiapicustombaseurl/v2/operations/_multiapi_custom_base_url_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiCustomBaseUrlServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,7 @@ def test(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py index 4e32015206c..6c0778f461a 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +112,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +264,7 @@ async def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +336,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +453,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py index e1f498a2d7c..bf66c2887bc 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._operation_group_one_operations import build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py index da3504c7846..04aba94b57c 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -31,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -140,7 +145,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,7 +189,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +338,7 @@ def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +410,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,7 +527,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py index 9a9c39d3236..4345de484fb 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py index 326bb9573bf..e7a5a3dd74b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_one_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,7 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) :rtype: ~multiapidataplane.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py index 489551a0ff8..9ff1afd2622 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_one_operations import build_test_three_request, build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +102,7 @@ async def test_two( :rtype: ~multiapidataplane.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py index e32b8296148..62a704394e2 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/aio/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._operation_group_two_operations import build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py index 17ec00a6f6d..f03d6739e97 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,7 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo :rtype: ~multiapidataplane.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py index ef8e9971e81..80e4554b0b8 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -140,7 +145,7 @@ def test_two( :rtype: ~multiapidataplane.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -204,7 +209,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py index 76539cebc32..d0b3d469960 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v2/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py index b16f5fcf82f..51e4f058d06 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,6 +34,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +62,7 @@ def test_paging(self, **kwargs: Any) -> AsyncIterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -137,7 +142,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py index 2a0203eb87d..6bec77d0dee 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,6 +35,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> AsyncIterable["_models.M cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ async def test_two( :rtype: ~multiapidataplane.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py index 9f4e58ef55e..6ae64795ada 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/aio/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_two_operations import build_test_five_request, build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py index 5769910d66f..4532a04d5a0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,7 +184,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py index ceba61328c6..0e198d2b0ef 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +110,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,7 +219,7 @@ def test_two( :rtype: ~multiapidataplane.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py index a82dae7dcf0..d208240aa57 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiDataPlane/multiapidataplane/v3/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +206,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_multiapi_service_client_operations.py index 8bb15adc70e..0219bdc3dbf 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +112,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +265,7 @@ async def _test_lro_and_paging_initial( client_request_id: Optional[str] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +338,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +455,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_operation_group_one_operations.py index f646db4c8fa..f8c13fe1c79 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._operation_group_one_operations import build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_multiapi_service_client_operations.py index c1bd4ccd99d..1667d4c8f50 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -31,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -140,7 +145,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,7 +189,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +339,7 @@ def _test_lro_and_paging_initial( client_request_id: Optional[str] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +412,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -524,7 +529,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_operation_group_one_operations.py index f079abae401..c8f6aca5678 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_multiapi_service_client_operations.py index fffe99d622a..005dac84f0b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_one_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,7 @@ async def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: An :rtype: ~multiapikeywordonly.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_one_operations.py index c43ac6893bd..cee63f303da 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_one_operations import build_test_three_request, build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +102,7 @@ async def test_two( :rtype: ~multiapikeywordonly.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_two_operations.py index ac3e6e9f0fb..5a2e682d5f5 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/aio/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._operation_group_two_operations import build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_multiapi_service_client_operations.py index fedfd2c4cb6..2042ca97598 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,7 @@ def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: Any) -> :rtype: ~multiapikeywordonly.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_one_operations.py index 46a66b547fd..2877ae1fdfb 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -140,7 +145,7 @@ def test_two( :rtype: ~multiapikeywordonly.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -204,7 +209,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_two_operations.py index 50a383b1652..bc32eac6aa7 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v2/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_multiapi_service_client_operations.py index afc2a244c67..0f6f6abb0f1 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -33,6 +34,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +62,7 @@ def test_paging(self, **kwargs: Any) -> AsyncIterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -138,7 +143,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_one_operations.py index 81e743ffa9b..8d47a2f0f05 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,6 +35,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> AsyncIterable["_models.M cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ async def test_two( :rtype: ~multiapikeywordonly.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_two_operations.py index 0cf3a5901d5..8ef944418fc 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/aio/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_two_operations import build_test_five_request, build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_multiapi_service_client_operations.py index 9b8c01be0fd..4936107a744 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_one_operations.py index ee0b7fd1688..bb41543f524 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +110,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,7 +219,7 @@ def test_two( :rtype: ~multiapikeywordonly.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_two_operations.py index fc1cafa3918..25bd3ef9121 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiKeywordOnly/multiapikeywordonly/v3/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +206,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py index accf3bdd936..356b1537d1b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +190,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +339,7 @@ def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +411,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -523,7 +528,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py index b4ae1352002..c5aa4bca4e5 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py index e3726c468db..bdebed04763 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo :rtype: ~multiapinoasync.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py index 97bb504326f..43eb0f6d90b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_two( :rtype: ~multiapinoasync.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +210,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py index ae3467f07e8..0985856792e 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py index 3c4b16e49d1..8e6ccb2ba82 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -100,7 +105,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py index 5b80e98579c..3b540720eeb 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +111,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +220,7 @@ def test_two( :rtype: ~multiapinoasync.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py index 2ceea7fc893..d31b1fee492 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -142,7 +147,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +207,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/aio/operations/_operation_group_one_operations.py index 602db94820c..3335c32db1b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._operation_group_one_operations import build_test_two_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py index 87e6b192d9f..775e0d70b2d 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v0/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_multiapi_service_client_operations.py index be9f7dfc9fc..139cedcc01b 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +112,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +264,7 @@ async def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +336,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +453,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_operation_group_one_operations.py index be420cd1551..772795102c0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ...operations._operation_group_one_operations import build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py index 59e21cda8db..4b4b7787829 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -31,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -140,7 +145,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,7 +189,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +338,7 @@ def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +410,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,7 +527,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py index 885b87f2dbb..d3642d91846 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiSecurity/multiapisecurity/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py index c362f1658af..a1cf4362317 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +113,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +265,7 @@ async def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +338,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +455,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py index 4af6ddde8f4..6b909c30028 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_one_operations import build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py index 0222dd4984d..151140b66b0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +190,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +339,7 @@ def _test_lro_and_paging_initial( test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +412,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -524,7 +529,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py index c3f59a43286..bd12c2d936c 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py index e17c475acd8..1eae7eead17 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._multiapi_service_client_operations import build_test_different_calls_request, build_test_one_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ async def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) :rtype: ~multiapiwithsubmodule.submodule.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py index 6ac456b1438..2acfcc6d071 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ...operations._operation_group_one_operations import build_test_three_request, build_test_two_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,7 +103,7 @@ async def test_two( :rtype: ~multiapiwithsubmodule.submodule.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py index 51e68c9b958..af533360a28 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ...operations._operation_group_two_operations import build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py index 9f3de161a94..75ee72e7d0d 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def test_one(self, id: int, message: Optional[str] = None, **kwargs: Any) -> _mo :rtype: ~multiapiwithsubmodule.submodule.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py index 225c3a17316..405800b440c 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ def test_two( :rtype: ~multiapiwithsubmodule.submodule.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +210,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py index e1fefa0b582..8cac92a5466 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def test_four(self, parameter_one: bool, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py index 8d7c779f57a..d5032cfec97 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,6 +35,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ def test_paging(self, **kwargs: Any) -> AsyncIterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +144,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py index 2dfa561d934..859e77d95f8 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,6 +36,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> AsyncIterable["_models.M cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +187,7 @@ async def test_two( :rtype: ~multiapiwithsubmodule.submodule.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py index d9b89fe8ff5..968205204e9 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ...operations._operation_group_two_operations import build_test_five_request, build_test_four_request from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py index f7a277432f8..518e11df628 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -100,7 +105,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py index 5b816b3f9c6..0cd9fdc8ae0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -106,7 +111,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +220,7 @@ def test_two( :rtype: ~multiapiwithsubmodule.submodule.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py index 812cfc97274..da144e12350 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -142,7 +147,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +207,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/aio/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/aio/operations/_operations.py index 2d5dd55a5dd..b6af7d542e3 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/aio/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,15 +40,19 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from ..._validation import api_version_validation from ...operations._operations import build_operation_group_one_test_three_request @@ -92,7 +97,7 @@ async def test_two( :rtype: ~multiapicombiner.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +165,7 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,7 +219,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> AsyncIterable["_models.M cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +319,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +383,7 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +432,7 @@ async def _test_lro_and_paging_initial( client_request_id: Optional[str] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -478,7 +483,7 @@ async def _test_lro_and_paging_initial( async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -624,7 +629,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -757,7 +762,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -815,7 +820,7 @@ async def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: An :rtype: ~multiapicombiner.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -877,7 +882,7 @@ def test_paging(self, **kwargs: Any) -> AsyncIterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/operations/_operations.py index bd31cca6935..451d8b0f8fd 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from .._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,10 +43,10 @@ -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.mgmt.core.polling.arm_polling import ARMPolling -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from .._validation import api_version_validation def build_operation_group_one_test_two_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long @@ -136,7 +141,7 @@ def test_two( :rtype: ~multiapicombiner.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -204,7 +209,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +263,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -397,7 +402,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +466,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -610,7 +615,7 @@ def _test_lro_and_paging_initial( client_request_id: Optional[str] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -661,7 +666,7 @@ def _test_lro_and_paging_initial( def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -806,7 +811,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -939,7 +944,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -997,7 +1002,7 @@ def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: Any) -> :rtype: ~multiapicombiner.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1059,7 +1064,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/aio/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/aio/operations/_operations.py index 068c786e58b..5487c50e713 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/aio/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,6 +41,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements async def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +267,7 @@ async def _test_lro_and_paging_initial( client_request_id: Optional[str] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +340,7 @@ async def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -452,7 +457,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,7 +526,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/operations/_operations.py index 400589fecb7..9f24dd704da 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v1/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -162,7 +167,7 @@ def test_one( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +211,7 @@ def test_one( # pylint: disable=inconsistent-return-statements def _test_lro_initial( self, product: Optional[Union[_models.Product, IO[bytes]]] = None, **kwargs: Any ) -> Optional[_models.Product]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,7 +361,7 @@ def _test_lro_and_paging_initial( client_request_id: Optional[str] = None, **kwargs: Any ) -> _models.PagingResult: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,7 +434,7 @@ def begin_test_lro_and_paging( cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -546,7 +551,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -615,7 +620,7 @@ def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/aio/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/aio/operations/_operations.py index 9afa2cf151c..b491366faeb 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/aio/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -35,6 +36,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: An :rtype: ~multiapicombiner.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +122,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +229,7 @@ async def test_two( :rtype: ~multiapicombiner.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +293,7 @@ async def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +363,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/operations/_operations.py index de86363c2c3..a0d13f2b3dc 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v2/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -163,7 +168,7 @@ def test_one(self, *, id: int, message: Optional[str] = None, **kwargs: Any) -> :rtype: ~multiapicombiner.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +334,7 @@ def test_two( :rtype: ~multiapicombiner.v2.models.ModelTwo :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,7 +398,7 @@ def test_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,7 +468,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/aio/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/aio/operations/_operations.py index c6d9d3059ec..8e89514af11 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/aio/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ ) from .._vendor import MultiapiServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ def test_paging(self, **kwargs: Any) -> AsyncIterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +149,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,7 +225,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> AsyncIterable["_models.M cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +334,7 @@ async def test_two( :rtype: ~multiapicombiner.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -452,7 +457,7 @@ async def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -512,7 +517,7 @@ async def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/operations/_operations.py b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/operations/_operations.py index 925726c54d0..480e7b1e9f0 100644 --- a/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/operations/_operations.py +++ b/packages/autorest.python/test/multiapi/Expected/AcceptanceTests/multiapicombiner/multiapicombiner/v3/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._serialization import Serializer from .._vendor import MultiapiServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -180,7 +185,7 @@ def test_paging(self, **kwargs: Any) -> Iterable["_models.ModelThree"]: cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -261,7 +266,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +342,7 @@ def test_operation_group_paging(self, **kwargs: Any) -> Iterable["_models.ModelT cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -446,7 +451,7 @@ def test_two( :rtype: ~multiapicombiner.v3.models.ModelThree :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,7 +574,7 @@ def test_four( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +634,7 @@ def test_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py index 318fdbf37bf..cb47773374c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_pets_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +35,10 @@ build_create_cat_ap_true_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -101,7 +106,7 @@ async def create_ap_true( :rtype: ~additionalproperties.models.PetAPTrue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -196,7 +201,7 @@ async def create_cat_ap_true( :rtype: ~additionalproperties.models.CatAPTrue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -291,7 +296,7 @@ async def create_ap_object( :rtype: ~additionalproperties.models.PetAPObject :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +391,7 @@ async def create_ap_string( :rtype: ~additionalproperties.models.PetAPString :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -481,7 +486,7 @@ async def create_ap_in_properties( :rtype: ~additionalproperties.models.PetAPInProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -582,7 +587,7 @@ async def create_ap_in_properties_with_ap_string( :rtype: ~additionalproperties.models.PetAPInPropertiesWithAPString :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py index 9fa0cf3203d..2e964d7390a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_pets_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -199,7 +204,7 @@ def create_ap_true( :rtype: ~additionalproperties.models.PetAPTrue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,7 +299,7 @@ def create_cat_ap_true( :rtype: ~additionalproperties.models.CatAPTrue :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +394,7 @@ def create_ap_object( :rtype: ~additionalproperties.models.PetAPObject :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +489,7 @@ def create_ap_string( :rtype: ~additionalproperties.models.PetAPString :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -579,7 +584,7 @@ def create_ap_in_properties( :rtype: ~additionalproperties.models.PetAPInProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -680,7 +685,7 @@ def create_ap_in_properties_with_ap_string( :rtype: ~additionalproperties.models.PetAPInPropertiesWithAPString :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py index dcfbb0a8a37..d12850400fa 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_anything_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ ) from .._vendor import AnythingClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,7 @@ async def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +101,7 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -143,7 +148,7 @@ async def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +197,7 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +244,7 @@ async def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +293,7 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py index 4c3afb09dfd..978d2a14679 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_anything_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import AnythingClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -126,7 +131,7 @@ def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +180,7 @@ def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +276,7 @@ def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,7 +323,7 @@ def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -367,7 +372,7 @@ def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py index ea9dcbc6c91..e923f96ffe5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_array_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -98,6 +99,10 @@ build_put_uuid_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -129,7 +134,7 @@ async def get_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,7 +181,7 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +228,7 @@ async def get_empty(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +311,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +366,7 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +449,7 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +504,7 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -546,7 +551,7 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -593,7 +598,7 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -676,7 +681,7 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,7 +736,7 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +783,7 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -825,7 +830,7 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -908,7 +913,7 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -963,7 +968,7 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1010,7 +1015,7 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1057,7 +1062,7 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1140,7 +1145,7 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1195,7 +1200,7 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1242,7 +1247,7 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1289,7 +1294,7 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1372,7 +1377,7 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1427,7 +1432,7 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1474,7 +1479,7 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1521,7 +1526,7 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1604,7 +1609,7 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1659,7 +1664,7 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.FooEnum :rtype: list[str or ~bodyarray.models.FooEnum] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1743,7 +1748,7 @@ async def put_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1798,7 +1803,7 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, _models. :rtype: list[str or ~bodyarray.models.Enum0] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1882,7 +1887,7 @@ async def put_string_enum_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1937,7 +1942,7 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1984,7 +1989,7 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2032,7 +2037,7 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2118,7 +2123,7 @@ async def put_uuid_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2173,7 +2178,7 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2220,7 +2225,7 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2303,7 +2308,7 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2358,7 +2363,7 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2405,7 +2410,7 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2453,7 +2458,7 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2539,7 +2544,7 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2594,7 +2599,7 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2641,7 +2646,7 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2689,7 +2694,7 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2775,7 +2780,7 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2830,7 +2835,7 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: :rtype: list[~datetime.timedelta] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2913,7 +2918,7 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2969,7 +2974,7 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3055,7 +3060,7 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3110,7 +3115,7 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3158,7 +3163,7 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3205,7 +3210,7 @@ async def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3252,7 +3257,7 @@ async def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3300,7 +3305,7 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3348,7 +3353,7 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3396,7 +3401,7 @@ async def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3482,7 +3487,7 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3537,7 +3542,7 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3584,7 +3589,7 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3631,7 +3636,7 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3678,7 +3683,7 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3725,7 +3730,7 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3808,7 +3813,7 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3863,7 +3868,7 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3910,7 +3915,7 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3958,7 +3963,7 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4006,7 +4011,7 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4054,7 +4059,7 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4140,7 +4145,7 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py index ea3c80eee1f..3fb751cd1ed 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_array_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1082,7 +1087,7 @@ def get_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1129,7 +1134,7 @@ def get_invalid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1176,7 +1181,7 @@ def get_empty(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1259,7 +1264,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,7 +1319,7 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1397,7 +1402,7 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1452,7 +1457,7 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1499,7 +1504,7 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1546,7 +1551,7 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1629,7 +1634,7 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1684,7 +1689,7 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1731,7 +1736,7 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1778,7 +1783,7 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1861,7 +1866,7 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1916,7 +1921,7 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1963,7 +1968,7 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2010,7 +2015,7 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2093,7 +2098,7 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2148,7 +2153,7 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2195,7 +2200,7 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2242,7 +2247,7 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2325,7 +2330,7 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2380,7 +2385,7 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2427,7 +2432,7 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2474,7 +2479,7 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2557,7 +2562,7 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2612,7 +2617,7 @@ def get_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.FooEnum]]: :rtype: list[str or ~bodyarray.models.FooEnum] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2696,7 +2701,7 @@ def put_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2751,7 +2756,7 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.Enum0] :rtype: list[str or ~bodyarray.models.Enum0] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2835,7 +2840,7 @@ def put_string_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2890,7 +2895,7 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2937,7 +2942,7 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2985,7 +2990,7 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3071,7 +3076,7 @@ def put_uuid_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3126,7 +3131,7 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3173,7 +3178,7 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3256,7 +3261,7 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3311,7 +3316,7 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3358,7 +3363,7 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3406,7 +3411,7 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3492,7 +3497,7 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3547,7 +3552,7 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3594,7 +3599,7 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3642,7 +3647,7 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3728,7 +3733,7 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3783,7 +3788,7 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: :rtype: list[~datetime.timedelta] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3866,7 +3871,7 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3922,7 +3927,7 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4008,7 +4013,7 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4063,7 +4068,7 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4111,7 +4116,7 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4158,7 +4163,7 @@ def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4205,7 +4210,7 @@ def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4253,7 +4258,7 @@ def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4301,7 +4306,7 @@ def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4349,7 +4354,7 @@ def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~bodyarray.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4435,7 +4440,7 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4490,7 +4495,7 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4537,7 +4542,7 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4584,7 +4589,7 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4631,7 +4636,7 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4678,7 +4683,7 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4761,7 +4766,7 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4816,7 +4821,7 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4863,7 +4868,7 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4911,7 +4916,7 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4959,7 +4964,7 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5007,7 +5012,7 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5093,7 +5098,7 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py index b677badb919..a8c57560ecb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_array_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -98,6 +99,10 @@ build_put_uuid_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -129,7 +134,7 @@ async def get_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,7 +181,7 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +228,7 @@ async def get_empty(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +311,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +366,7 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +449,7 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +504,7 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -546,7 +551,7 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -593,7 +598,7 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -676,7 +681,7 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,7 +736,7 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +783,7 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -825,7 +830,7 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -908,7 +913,7 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -963,7 +968,7 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1010,7 +1015,7 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1057,7 +1062,7 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1140,7 +1145,7 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1195,7 +1200,7 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1242,7 +1247,7 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1289,7 +1294,7 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1372,7 +1377,7 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1427,7 +1432,7 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1474,7 +1479,7 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1521,7 +1526,7 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1604,7 +1609,7 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1659,7 +1664,7 @@ async def get_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.FooEnum :rtype: list[str or ~vanilla.body.array.models.FooEnum] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1743,7 +1748,7 @@ async def put_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1798,7 +1803,7 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, _models. :rtype: list[str or ~vanilla.body.array.models.Enum0] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1882,7 +1887,7 @@ async def put_string_enum_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1937,7 +1942,7 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1984,7 +1989,7 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2032,7 +2037,7 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2118,7 +2123,7 @@ async def put_uuid_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2173,7 +2178,7 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2220,7 +2225,7 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2303,7 +2308,7 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2358,7 +2363,7 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2405,7 +2410,7 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2453,7 +2458,7 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2539,7 +2544,7 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2594,7 +2599,7 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2641,7 +2646,7 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2689,7 +2694,7 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2775,7 +2780,7 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2830,7 +2835,7 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: :rtype: list[~datetime.timedelta] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2913,7 +2918,7 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2969,7 +2974,7 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3055,7 +3060,7 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3110,7 +3115,7 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3158,7 +3163,7 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3205,7 +3210,7 @@ async def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3252,7 +3257,7 @@ async def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3300,7 +3305,7 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3348,7 +3353,7 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3396,7 +3401,7 @@ async def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3482,7 +3487,7 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3537,7 +3542,7 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3584,7 +3589,7 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3631,7 +3636,7 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3678,7 +3683,7 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3725,7 +3730,7 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3808,7 +3813,7 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3863,7 +3868,7 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3910,7 +3915,7 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3958,7 +3963,7 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4006,7 +4011,7 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4054,7 +4059,7 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4140,7 +4145,7 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py index 8c724d1cb98..9b087ca2058 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1082,7 +1087,7 @@ def get_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1129,7 +1134,7 @@ def get_invalid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1176,7 +1181,7 @@ def get_empty(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1259,7 +1264,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,7 +1319,7 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1397,7 +1402,7 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1452,7 +1457,7 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1499,7 +1504,7 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: :rtype: list[bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1546,7 +1551,7 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1629,7 +1634,7 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1684,7 +1689,7 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1731,7 +1736,7 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1778,7 +1783,7 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1861,7 +1866,7 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1916,7 +1921,7 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1963,7 +1968,7 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: :rtype: list[int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2010,7 +2015,7 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2093,7 +2098,7 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2148,7 +2153,7 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2195,7 +2200,7 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2242,7 +2247,7 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2325,7 +2330,7 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2380,7 +2385,7 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2427,7 +2432,7 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: :rtype: list[float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2474,7 +2479,7 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2557,7 +2562,7 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2612,7 +2617,7 @@ def get_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.FooEnum]]: :rtype: list[str or ~vanilla.body.array.models.FooEnum] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2696,7 +2701,7 @@ def put_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2751,7 +2756,7 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[Union[str, _models.Enum0] :rtype: list[str or ~vanilla.body.array.models.Enum0] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2835,7 +2840,7 @@ def put_string_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2890,7 +2895,7 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2937,7 +2942,7 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2985,7 +2990,7 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3071,7 +3076,7 @@ def put_uuid_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3126,7 +3131,7 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: :rtype: list[str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3173,7 +3178,7 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3256,7 +3261,7 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3311,7 +3316,7 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3358,7 +3363,7 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: :rtype: list[~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3406,7 +3411,7 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3492,7 +3497,7 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3547,7 +3552,7 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3594,7 +3599,7 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3642,7 +3647,7 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: :rtype: list[~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3728,7 +3733,7 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3783,7 +3788,7 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: :rtype: list[~datetime.timedelta] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3866,7 +3871,7 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3922,7 +3927,7 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4008,7 +4013,7 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4063,7 +4068,7 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4111,7 +4116,7 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: :rtype: list[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4158,7 +4163,7 @@ def get_complex_null(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4205,7 +4210,7 @@ def get_complex_empty(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4253,7 +4258,7 @@ def get_complex_item_null(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4301,7 +4306,7 @@ def get_complex_item_empty(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4349,7 +4354,7 @@ def get_complex_valid(self, **kwargs: Any) -> List[_models.Product]: :rtype: list[~vanilla.body.array.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4435,7 +4440,7 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4490,7 +4495,7 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4537,7 +4542,7 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4584,7 +4589,7 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4631,7 +4636,7 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4678,7 +4683,7 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: :rtype: list[list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4761,7 +4766,7 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4816,7 +4821,7 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4863,7 +4868,7 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4911,7 +4916,7 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4959,7 +4964,7 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5007,7 +5012,7 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: :rtype: list[dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5093,7 +5098,7 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_download_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_download_operations.py index 363591b090a..b216f6ab6b5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_download_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_download_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterator, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._download_operations import build_error_stream_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,7 @@ async def error_stream(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py index 76dc849f850..089728539de 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_upload_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, IO, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._upload_operations import build_binary_request, build_file_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +66,7 @@ async def file( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ async def binary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_download_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_download_operations.py index 5b8d1bd42e1..be598b602d7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_download_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_download_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterator, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,7 @@ def error_stream(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py index 2e51cd72edd..f8b0ff9e181 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_upload_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, IO, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +95,7 @@ def file(self, file_param: IO[bytes], **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +144,7 @@ def binary(self, file_param: IO[bytes], **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py index b564c8c55c5..98dd0493957 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_bool_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ build_put_true_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def get_true(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +116,7 @@ async def put_true(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +165,7 @@ async def get_false(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -207,7 +212,7 @@ async def put_false(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +261,7 @@ async def get_null(self, **kwargs: Any) -> Optional[bool]: :rtype: bool or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +308,7 @@ async def get_invalid(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py index c06676fcb74..601c4a091f9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_bool_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -152,7 +157,7 @@ def get_true(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +204,7 @@ def put_true(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +253,7 @@ def get_false(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +300,7 @@ def put_false(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,7 +349,7 @@ def get_null(self, **kwargs: Any) -> Optional[bool]: :rtype: bool or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -391,7 +396,7 @@ def get_invalid(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py index 2cd8045e36b..bc083defa5a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_byte_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_put_non_ascii_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def get_null(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def get_empty(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ async def get_non_ascii(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ async def put_non_ascii( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +262,7 @@ async def get_invalid(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py index fddf4163394..8bc2a8b282b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_byte_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +138,7 @@ def get_null(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ def get_empty(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +232,7 @@ def get_non_ascii(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +282,7 @@ def put_non_ascii(self, byte_body: bytes, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +330,7 @@ def get_invalid(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py index 6f3408d0994..cb57ae50e81 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_byte_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_put_non_ascii_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def get_null(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def get_empty(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ async def get_non_ascii(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ async def put_non_ascii( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +262,7 @@ async def get_invalid(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py index 423950ae10a..6265e6f9eb6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_byte_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -133,7 +138,7 @@ def get_null(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ def get_empty(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +232,7 @@ def get_non_ascii(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +282,7 @@ def put_non_ascii(self, byte_body: bytes, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +330,7 @@ def get_invalid(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py index f4ce8d0b43c..04f754b7055 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_array_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_put_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def get_valid(self, **kwargs: Any) -> _models.ArrayWrapper: :rtype: ~bodycomplex.models.ArrayWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +119,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +168,7 @@ async def get_empty(self, **kwargs: Any) -> _models.ArrayWrapper: :rtype: ~bodycomplex.models.ArrayWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,7 +219,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,7 +268,7 @@ async def get_not_provided(self, **kwargs: Any) -> _models.ArrayWrapper: :rtype: ~bodycomplex.models.ArrayWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py index fdb4a5108be..c082f2ab325 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_basic_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +35,10 @@ build_put_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ async def get_valid(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +154,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +211,7 @@ async def get_invalid(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -253,7 +258,7 @@ async def get_empty(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +305,7 @@ async def get_null(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +352,7 @@ async def get_not_provided(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py index cff471b30d8..f456ddd90ea 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_dictionary_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ build_put_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def get_valid(self, **kwargs: Any) -> _models.DictionaryWrapper: :rtype: ~bodycomplex.models.DictionaryWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +120,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ async def get_empty(self, **kwargs: Any) -> _models.DictionaryWrapper: :rtype: ~bodycomplex.models.DictionaryWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +220,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -264,7 +269,7 @@ async def get_null(self, **kwargs: Any) -> _models.DictionaryWrapper: :rtype: ~bodycomplex.models.DictionaryWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -311,7 +316,7 @@ async def get_not_provided(self, **kwargs: Any) -> _models.DictionaryWrapper: :rtype: ~bodycomplex.models.DictionaryWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py index 546ee4eef0c..7e7386e10dd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_flattencomplex_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._flattencomplex_operations import build_get_valid_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,7 @@ async def get_valid(self, **kwargs: Any) -> _models.MyBaseType: :rtype: ~bodycomplex.models.MyBaseType :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py index 2f6a6b1f77c..20e03b97f05 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_inheritance_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._inheritance_operations import build_get_valid_request, build_put_valid_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def get_valid(self, **kwargs: Any) -> _models.Siamese: :rtype: ~bodycomplex.models.Siamese :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +153,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py index ce40c42d288..7b2d91b5d2c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphicrecursive_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._polymorphicrecursive_operations import build_get_valid_request, build_put_valid_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def get_valid(self, **kwargs: Any) -> _models.Fish: :rtype: ~bodycomplex.models.Fish :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +302,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py index 895acbf8ba3..0612fdcc65a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_polymorphism_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -37,6 +38,10 @@ build_put_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +73,7 @@ async def get_valid(self, **kwargs: Any) -> _models.Fish: :rtype: ~bodycomplex.models.Fish :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -247,7 +252,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +307,7 @@ async def get_dot_syntax(self, **kwargs: Any) -> _models.DotFish: :rtype: ~bodycomplex.models.DotFish :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +356,7 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> _models.DotFis :rtype: ~bodycomplex.models.DotFishMarket :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,7 +405,7 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> _models.Dot :rtype: ~bodycomplex.models.DotFishMarket :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +453,7 @@ async def get_complicated(self, **kwargs: Any) -> _models.Salmon: :rtype: ~bodycomplex.models.Salmon :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +539,7 @@ async def put_complicated( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -625,7 +630,7 @@ async def put_missing_discriminator( :rtype: ~bodycomplex.models.Salmon :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -801,7 +806,7 @@ async def put_valid_missing_required( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py index c0d5ac3ea46..96e9660f005 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_primitive_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -51,6 +52,10 @@ build_put_string_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +87,7 @@ async def get_int(self, **kwargs: Any) -> _models.IntWrapper: :rtype: ~bodycomplex.models.IntWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +171,7 @@ async def put_int( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +226,7 @@ async def get_long(self, **kwargs: Any) -> _models.LongWrapper: :rtype: ~bodycomplex.models.LongWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -305,7 +310,7 @@ async def put_long( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +365,7 @@ async def get_float(self, **kwargs: Any) -> _models.FloatWrapper: :rtype: ~bodycomplex.models.FloatWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +449,7 @@ async def put_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +504,7 @@ async def get_double(self, **kwargs: Any) -> _models.DoubleWrapper: :rtype: ~bodycomplex.models.DoubleWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -586,7 +591,7 @@ async def put_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +646,7 @@ async def get_bool(self, **kwargs: Any) -> _models.BooleanWrapper: :rtype: ~bodycomplex.models.BooleanWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -725,7 +730,7 @@ async def put_bool( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -780,7 +785,7 @@ async def get_string(self, **kwargs: Any) -> _models.StringWrapper: :rtype: ~bodycomplex.models.StringWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -864,7 +869,7 @@ async def put_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -919,7 +924,7 @@ async def get_date(self, **kwargs: Any) -> _models.DateWrapper: :rtype: ~bodycomplex.models.DateWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1003,7 +1008,7 @@ async def put_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1058,7 +1063,7 @@ async def get_date_time(self, **kwargs: Any) -> _models.DatetimeWrapper: :rtype: ~bodycomplex.models.DatetimeWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1144,7 +1149,7 @@ async def put_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1199,7 +1204,7 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> _models.Datetimerfc1123W :rtype: ~bodycomplex.models.Datetimerfc1123Wrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1285,7 +1290,7 @@ async def put_date_time_rfc1123( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1340,7 +1345,7 @@ async def get_duration(self, **kwargs: Any) -> _models.DurationWrapper: :rtype: ~bodycomplex.models.DurationWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1391,7 +1396,7 @@ async def put_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1440,7 +1445,7 @@ async def get_byte(self, **kwargs: Any) -> _models.ByteWrapper: :rtype: ~bodycomplex.models.ByteWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1491,7 +1496,7 @@ async def put_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py index 3b510ce86bc..2005b225849 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_readonlyproperty_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._readonlyproperty_operations import build_get_valid_request, build_put_valid_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +62,7 @@ async def get_valid(self, **kwargs: Any) -> _models.ReadonlyObj: :rtype: ~bodycomplex.models.ReadonlyObj :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +113,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py index 5b5a6317b8b..fcc616dc728 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -136,7 +141,7 @@ def get_valid(self, **kwargs: Any) -> _models.ArrayWrapper: :rtype: ~bodycomplex.models.ArrayWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,7 +192,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +241,7 @@ def get_empty(self, **kwargs: Any) -> _models.ArrayWrapper: :rtype: ~bodycomplex.models.ArrayWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -287,7 +292,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,7 +341,7 @@ def get_not_provided(self, **kwargs: Any) -> _models.ArrayWrapper: :rtype: ~bodycomplex.models.ArrayWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py index c771b58ee44..42e8c69f3d7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -153,7 +158,7 @@ def get_valid(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +242,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,7 +299,7 @@ def get_invalid(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +346,7 @@ def get_empty(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -388,7 +393,7 @@ def get_null(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +440,7 @@ def get_not_provided(self, **kwargs: Any) -> _models.Basic: :rtype: ~bodycomplex.models.Basic :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py index 62bf8c03604..cb46112d994 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -150,7 +155,7 @@ def get_valid(self, **kwargs: Any) -> _models.DictionaryWrapper: :rtype: ~bodycomplex.models.DictionaryWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,7 +206,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -250,7 +255,7 @@ def get_empty(self, **kwargs: Any) -> _models.DictionaryWrapper: :rtype: ~bodycomplex.models.DictionaryWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +306,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +355,7 @@ def get_null(self, **kwargs: Any) -> _models.DictionaryWrapper: :rtype: ~bodycomplex.models.DictionaryWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -397,7 +402,7 @@ def get_not_provided(self, **kwargs: Any) -> _models.DictionaryWrapper: :rtype: ~bodycomplex.models.DictionaryWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py index f66660b17fd..648dc9a8b59 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,7 @@ def get_valid(self, **kwargs: Any) -> _models.MyBaseType: :rtype: ~bodycomplex.models.MyBaseType :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py index c0ad17bc582..f2db021b368 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,7 @@ def get_valid(self, **kwargs: Any) -> _models.Siamese: :rtype: ~bodycomplex.models.Siamese :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +187,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py index e73116ec2f1..c7a5caf3309 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,7 @@ def get_valid(self, **kwargs: Any) -> _models.Fish: :rtype: ~bodycomplex.models.Fish :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +336,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py index 7e76e8f129e..1efe26ad282 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -199,7 +204,7 @@ def get_valid(self, **kwargs: Any) -> _models.Fish: :rtype: ~bodycomplex.models.Fish :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +383,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +438,7 @@ def get_dot_syntax(self, **kwargs: Any) -> _models.DotFish: :rtype: ~bodycomplex.models.DotFish :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +487,7 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> _models.DotFishMarke :rtype: ~bodycomplex.models.DotFishMarket :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -531,7 +536,7 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> _models.DotFishMa :rtype: ~bodycomplex.models.DotFishMarket :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -579,7 +584,7 @@ def get_complicated(self, **kwargs: Any) -> _models.Salmon: :rtype: ~bodycomplex.models.Salmon :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -665,7 +670,7 @@ def put_complicated( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -756,7 +761,7 @@ def put_missing_discriminator( :rtype: ~bodycomplex.models.Salmon :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -932,7 +937,7 @@ def put_valid_missing_required( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py index 7e52e5db97d..aed81de0250 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from msrest import Serializer @@ -29,6 +30,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -403,7 +408,7 @@ def get_int(self, **kwargs: Any) -> _models.IntWrapper: :rtype: ~bodycomplex.models.IntWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,7 +492,7 @@ def put_int( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +547,7 @@ def get_long(self, **kwargs: Any) -> _models.LongWrapper: :rtype: ~bodycomplex.models.LongWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -626,7 +631,7 @@ def put_long( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,7 +686,7 @@ def get_float(self, **kwargs: Any) -> _models.FloatWrapper: :rtype: ~bodycomplex.models.FloatWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +770,7 @@ def put_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -820,7 +825,7 @@ def get_double(self, **kwargs: Any) -> _models.DoubleWrapper: :rtype: ~bodycomplex.models.DoubleWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -907,7 +912,7 @@ def put_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -962,7 +967,7 @@ def get_bool(self, **kwargs: Any) -> _models.BooleanWrapper: :rtype: ~bodycomplex.models.BooleanWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1046,7 +1051,7 @@ def put_bool( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1101,7 +1106,7 @@ def get_string(self, **kwargs: Any) -> _models.StringWrapper: :rtype: ~bodycomplex.models.StringWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1185,7 +1190,7 @@ def put_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1240,7 +1245,7 @@ def get_date(self, **kwargs: Any) -> _models.DateWrapper: :rtype: ~bodycomplex.models.DateWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1324,7 +1329,7 @@ def put_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1379,7 +1384,7 @@ def get_date_time(self, **kwargs: Any) -> _models.DatetimeWrapper: :rtype: ~bodycomplex.models.DatetimeWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1465,7 +1470,7 @@ def put_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1520,7 +1525,7 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> _models.Datetimerfc1123Wrapper :rtype: ~bodycomplex.models.Datetimerfc1123Wrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1606,7 +1611,7 @@ def put_date_time_rfc1123( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1661,7 +1666,7 @@ def get_duration(self, **kwargs: Any) -> _models.DurationWrapper: :rtype: ~bodycomplex.models.DurationWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1712,7 +1717,7 @@ def put_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1761,7 +1766,7 @@ def get_byte(self, **kwargs: Any) -> _models.ByteWrapper: :rtype: ~bodycomplex.models.ByteWrapper :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1812,7 +1817,7 @@ def put_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py index 35a4fdf0fe0..8e8cd27c698 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +96,7 @@ def get_valid(self, **kwargs: Any) -> _models.ReadonlyObj: :rtype: ~bodycomplex.models.ReadonlyObj :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -142,7 +147,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py index 816b5c09b3b..effe32974c4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_date_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -36,6 +37,10 @@ build_put_min_date_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +72,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: :rtype: ~datetime.date or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +119,7 @@ async def get_invalid_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ async def get_overflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +213,7 @@ async def get_underflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +264,7 @@ async def put_max_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,7 +312,7 @@ async def get_max_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +363,7 @@ async def put_min_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +411,7 @@ async def get_min_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py index 6a4785be2ef..e99808def7e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -179,7 +184,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.date]: :rtype: ~datetime.date or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -226,7 +231,7 @@ def get_invalid_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +278,7 @@ def get_overflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,7 +325,7 @@ def get_underflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -371,7 +376,7 @@ def put_max_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +424,7 @@ def get_max_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +475,7 @@ def put_min_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -518,7 +523,7 @@ def get_min_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py index dd1de791424..35c96e90bcc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_datetime_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -50,6 +51,10 @@ build_put_utc_min_date_time_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +133,7 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +180,7 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +278,7 @@ async def put_utc_max_date_time( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -328,7 +333,7 @@ async def put_utc_max_date_time7_digits( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -376,7 +381,7 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +428,7 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,7 +478,7 @@ async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -524,7 +529,7 @@ async def put_local_positive_offset_max_date_time( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +579,7 @@ async def get_local_positive_offset_lowercase_max_date_time( # pylint: disable= :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -623,7 +628,7 @@ async def get_local_positive_offset_uppercase_max_date_time( # pylint: disable= :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -674,7 +679,7 @@ async def put_local_negative_offset_max_date_time( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -724,7 +729,7 @@ async def get_local_negative_offset_uppercase_max_date_time( # pylint: disable= :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,7 +778,7 @@ async def get_local_negative_offset_lowercase_max_date_time( # pylint: disable= :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -824,7 +829,7 @@ async def put_utc_min_date_time( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -872,7 +877,7 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -923,7 +928,7 @@ async def put_local_positive_offset_min_date_time( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -971,7 +976,7 @@ async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1022,7 +1027,7 @@ async def put_local_negative_offset_min_date_time( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1070,7 +1075,7 @@ async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1117,7 +1122,7 @@ async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py index 0bda12c3c76..9bf539d2da6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -414,7 +419,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +466,7 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +513,7 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +560,7 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -606,7 +611,7 @@ def put_utc_max_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -661,7 +666,7 @@ def put_utc_max_date_time7_digits( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,7 +714,7 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -756,7 +761,7 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -806,7 +811,7 @@ def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +862,7 @@ def put_local_positive_offset_max_date_time( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -907,7 +912,7 @@ def get_local_positive_offset_lowercase_max_date_time( # pylint: disable=name-t :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -956,7 +961,7 @@ def get_local_positive_offset_uppercase_max_date_time( # pylint: disable=name-t :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1007,7 +1012,7 @@ def put_local_negative_offset_max_date_time( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1057,7 +1062,7 @@ def get_local_negative_offset_uppercase_max_date_time( # pylint: disable=name-t :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1111,7 @@ def get_local_negative_offset_lowercase_max_date_time( # pylint: disable=name-t :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1157,7 +1162,7 @@ def put_utc_min_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1205,7 +1210,7 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1256,7 +1261,7 @@ def put_local_positive_offset_min_date_time( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1304,7 +1309,7 @@ def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1360,7 @@ def put_local_negative_offset_min_date_time( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1403,7 +1408,7 @@ def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1450,7 +1455,7 @@ def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py index 4460188b419..b18050032ff 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_datetimerfc1123_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -37,6 +38,10 @@ build_put_utc_min_date_time_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +73,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +120,7 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +265,7 @@ async def put_utc_max_date_time( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +313,7 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -355,7 +360,7 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +411,7 @@ async def put_utc_min_date_time( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,7 +459,7 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py index a375dcb76cf..cad7162b770 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -193,7 +198,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,7 +245,7 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -287,7 +292,7 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +339,7 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +390,7 @@ def put_utc_max_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +438,7 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +485,7 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -531,7 +536,7 @@ def put_utc_min_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -579,7 +584,7 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py index 97004c27b85..bffd52227b3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_dictionary_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -94,6 +95,10 @@ build_put_string_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -125,7 +130,7 @@ async def get_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -172,7 +177,7 @@ async def get_empty(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,7 +260,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +315,7 @@ async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +362,7 @@ async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +409,7 @@ async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -451,7 +456,7 @@ async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -498,7 +503,7 @@ async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +586,7 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +641,7 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -683,7 +688,7 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -730,7 +735,7 @@ async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -813,7 +818,7 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -868,7 +873,7 @@ async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -915,7 +920,7 @@ async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -962,7 +967,7 @@ async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1045,7 +1050,7 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1105,7 @@ async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1147,7 +1152,7 @@ async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1194,7 +1199,7 @@ async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1277,7 +1282,7 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1332,7 +1337,7 @@ async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1379,7 +1384,7 @@ async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1426,7 +1431,7 @@ async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1509,7 +1514,7 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1564,7 +1569,7 @@ async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1611,7 +1616,7 @@ async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1658,7 +1663,7 @@ async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1741,7 +1746,7 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1796,7 +1801,7 @@ async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1843,7 +1848,7 @@ async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1890,7 +1895,7 @@ async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: :rtype: dict[str, ~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1973,7 +1978,7 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2028,7 +2033,7 @@ async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date] :rtype: dict[str, ~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2075,7 +2080,7 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date :rtype: dict[str, ~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2123,7 +2128,7 @@ async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetim :rtype: dict[str, ~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2209,7 +2214,7 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2264,7 +2269,7 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime. :rtype: dict[str, ~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2311,7 +2316,7 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime :rtype: dict[str, ~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2359,7 +2364,7 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime :rtype: dict[str, ~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2445,7 +2450,7 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2500,7 +2505,7 @@ async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelt :rtype: dict[str, ~datetime.timedelta] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2583,7 +2588,7 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2639,7 +2644,7 @@ async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytes]: :rtype: dict[str, bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2725,7 +2730,7 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2781,7 +2786,7 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytes]: :rtype: dict[str, bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2829,7 +2834,7 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: :rtype: dict[str, bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2876,7 +2881,7 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, _models.Wi :rtype: dict[str, ~bodydictionary.models.Widget] or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2923,7 +2928,7 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, _models.Widget]: :rtype: dict[str, ~bodydictionary.models.Widget] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2971,7 +2976,7 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, _models.Widget :rtype: dict[str, ~bodydictionary.models.Widget] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3019,7 +3024,7 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, _models.Widge :rtype: dict[str, ~bodydictionary.models.Widget] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3067,7 +3072,7 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, _models.Widget]: :rtype: dict[str, ~bodydictionary.models.Widget] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3153,7 +3158,7 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3208,7 +3213,7 @@ async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: :rtype: dict[str, list[str]] or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3255,7 +3260,7 @@ async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3302,7 +3307,7 @@ async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3349,7 +3354,7 @@ async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3397,7 +3402,7 @@ async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3483,7 +3488,7 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3538,7 +3543,7 @@ async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3585,7 +3590,7 @@ async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]] :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3633,7 +3638,7 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, s :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3681,7 +3686,7 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3730,7 +3735,7 @@ async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]] :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3819,7 +3824,7 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py index acc7cd9c6bc..6279400fe82 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import datetime from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1017,7 +1022,7 @@ def get_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1064,7 +1069,7 @@ def get_empty(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1147,7 +1152,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1202,7 +1207,7 @@ def get_null_value(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1249,7 +1254,7 @@ def get_null_key(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1296,7 +1301,7 @@ def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1343,7 +1348,7 @@ def get_invalid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1390,7 +1395,7 @@ def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1473,7 +1478,7 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1528,7 +1533,7 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1575,7 +1580,7 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: :rtype: dict[str, bool] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1622,7 +1627,7 @@ def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1705,7 +1710,7 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1760,7 +1765,7 @@ def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1807,7 +1812,7 @@ def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1854,7 +1859,7 @@ def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1937,7 +1942,7 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1992,7 +1997,7 @@ def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2039,7 +2044,7 @@ def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2086,7 +2091,7 @@ def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2169,7 +2174,7 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2224,7 +2229,7 @@ def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2271,7 +2276,7 @@ def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2318,7 +2323,7 @@ def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2401,7 +2406,7 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2456,7 +2461,7 @@ def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2503,7 +2508,7 @@ def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: :rtype: dict[str, float] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2550,7 +2555,7 @@ def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2633,7 +2638,7 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2688,7 +2693,7 @@ def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2735,7 +2740,7 @@ def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: :rtype: dict[str, str] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2782,7 +2787,7 @@ def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: :rtype: dict[str, ~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2865,7 +2870,7 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2920,7 +2925,7 @@ def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: :rtype: dict[str, ~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2967,7 +2972,7 @@ def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: :rtype: dict[str, ~datetime.date] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3015,7 +3020,7 @@ def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: :rtype: dict[str, ~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3101,7 +3106,7 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3156,7 +3161,7 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.dateti :rtype: dict[str, ~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3203,7 +3208,7 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datet :rtype: dict[str, ~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3251,7 +3256,7 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datet :rtype: dict[str, ~datetime.datetime] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3337,7 +3342,7 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3392,7 +3397,7 @@ def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: :rtype: dict[str, ~datetime.timedelta] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3475,7 +3480,7 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3531,7 +3536,7 @@ def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytes]: :rtype: dict[str, bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3617,7 +3622,7 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3673,7 +3678,7 @@ def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytes]: :rtype: dict[str, bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3721,7 +3726,7 @@ def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: :rtype: dict[str, bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3768,7 +3773,7 @@ def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, _models.Widget]] :rtype: dict[str, ~bodydictionary.models.Widget] or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3815,7 +3820,7 @@ def get_complex_empty(self, **kwargs: Any) -> Dict[str, _models.Widget]: :rtype: dict[str, ~bodydictionary.models.Widget] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3863,7 +3868,7 @@ def get_complex_item_null(self, **kwargs: Any) -> Dict[str, _models.Widget]: :rtype: dict[str, ~bodydictionary.models.Widget] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3911,7 +3916,7 @@ def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, _models.Widget]: :rtype: dict[str, ~bodydictionary.models.Widget] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3959,7 +3964,7 @@ def get_complex_valid(self, **kwargs: Any) -> Dict[str, _models.Widget]: :rtype: dict[str, ~bodydictionary.models.Widget] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4045,7 +4050,7 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4100,7 +4105,7 @@ def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: :rtype: dict[str, list[str]] or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4147,7 +4152,7 @@ def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4194,7 +4199,7 @@ def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4241,7 +4246,7 @@ def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4289,7 +4294,7 @@ def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: :rtype: dict[str, list[str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4375,7 +4380,7 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4430,7 +4435,7 @@ def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4477,7 +4482,7 @@ def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4525,7 +4530,7 @@ def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4573,7 +4578,7 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4622,7 +4627,7 @@ def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: :rtype: dict[str, dict[str, str]] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4711,7 +4716,7 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py index 8cf6a45c024..5a6fdc953fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_duration_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_put_positive_duration_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +119,7 @@ async def put_positive_duration( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py index d0e415561a5..97fec1d0745 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -120,7 +125,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +176,7 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +224,7 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +271,7 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py index 1871ac5e390..c270ce7e214 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_files_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterator, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_get_file_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def get_file(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +112,7 @@ async def get_file_large(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,7 +159,7 @@ async def get_empty_file(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py index 4d8dd154aa3..4bd2c99d2be 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_files_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterator, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -102,7 +107,7 @@ def get_file(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +154,7 @@ def get_file_large(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -196,7 +201,7 @@ def get_empty_file(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py index a724b086ede..89347b894c9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_formdata_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_upload_files_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,7 @@ async def upload_file(self, file_content: IO[bytes], file_name: str, **kwargs: A :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -124,7 +129,7 @@ async def upload_file_via_body(self, file_content: IO[bytes], **kwargs: Any) -> :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +183,7 @@ async def upload_files(self, file_content: List[IO[bytes]], **kwargs: Any) -> As :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py index ec54a079782..78b62c77516 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_formdata_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, IO, Iterator, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, IO, Iterator, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -112,7 +117,7 @@ def upload_file(self, file_content: IO[bytes], file_name: str, **kwargs: Any) -> :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,7 +175,7 @@ def upload_file_via_body(self, file_content: IO[bytes], **kwargs: Any) -> Iterat :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +229,7 @@ def upload_files(self, file_content: List[IO[bytes]], **kwargs: Any) -> Iterator :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py index 4f6fb3e23d3..992d73a395e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_formdataurlencoded_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_update_pet_with_form_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ async def update_pet_with_form( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +155,7 @@ async def partial_constant_body( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py index d9ec7d6a4e9..87ab98c293b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_formdataurlencoded_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -110,7 +115,7 @@ def update_pet_with_form( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +180,7 @@ def partial_constant_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations_operations.py index f50bdb8afc9..37829f7ab55 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_int_operations_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -42,6 +43,10 @@ build_put_unix_time_date_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,7 @@ async def get_null(self, **kwargs: Any) -> Optional[int]: :rtype: int or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +125,7 @@ async def get_invalid(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +172,7 @@ async def get_overflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,7 +219,7 @@ async def get_underflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -261,7 +266,7 @@ async def get_overflow_int64(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +313,7 @@ async def get_underflow_int64(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +362,7 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +412,7 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +462,7 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +512,7 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +560,7 @@ async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -606,7 +611,7 @@ async def put_unix_time_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,7 +659,7 @@ async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,7 +706,7 @@ async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime] :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations_operations.py index 5bb1f0a77b4..ad9efa9e143 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -272,7 +277,7 @@ def get_null(self, **kwargs: Any) -> Optional[int]: :rtype: int or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +324,7 @@ def get_invalid(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -366,7 +371,7 @@ def get_overflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +418,7 @@ def get_underflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -460,7 +465,7 @@ def get_overflow_int64(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +512,7 @@ def get_underflow_int64(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +561,7 @@ def put_max32(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -606,7 +611,7 @@ def put_max64(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +661,7 @@ def put_min32(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -706,7 +711,7 @@ def put_min64(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -754,7 +759,7 @@ def get_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -805,7 +810,7 @@ def put_unix_time_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -853,7 +858,7 @@ def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -900,7 +905,7 @@ def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py index 3c8947d72bb..1c9d563dc9c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_number_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -51,6 +52,10 @@ build_put_small_float_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +87,7 @@ async def get_null(self, **kwargs: Any) -> Optional[float]: :rtype: float or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -129,7 +134,7 @@ async def get_invalid_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,7 +181,7 @@ async def get_invalid_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +228,7 @@ async def get_invalid_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +279,7 @@ async def put_big_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +327,7 @@ async def get_big_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +378,7 @@ async def put_big_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -421,7 +426,7 @@ async def get_big_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +475,7 @@ async def put_big_double_positive_decimal( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,7 +524,7 @@ async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -568,7 +573,7 @@ async def put_big_double_negative_decimal( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,7 +622,7 @@ async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -668,7 +673,7 @@ async def put_big_decimal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +721,7 @@ async def get_big_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +770,7 @@ async def put_big_decimal_positive_decimal( # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -814,7 +819,7 @@ async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -863,7 +868,7 @@ async def put_big_decimal_negative_decimal( # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -912,7 +917,7 @@ async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -963,7 +968,7 @@ async def put_small_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1011,7 +1016,7 @@ async def get_small_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1062,7 +1067,7 @@ async def put_small_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1110,7 +1115,7 @@ async def get_small_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1161,7 +1166,7 @@ async def put_small_decimal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1209,7 +1214,7 @@ async def get_small_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py index 0fe1743d8fd..439a2b0755b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_number_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -430,7 +435,7 @@ def get_null(self, **kwargs: Any) -> Optional[float]: :rtype: float or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -477,7 +482,7 @@ def get_invalid_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -524,7 +529,7 @@ def get_invalid_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +576,7 @@ def get_invalid_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +627,7 @@ def put_big_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +675,7 @@ def get_big_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -721,7 +726,7 @@ def put_big_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -769,7 +774,7 @@ def get_big_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,7 +821,7 @@ def put_big_double_positive_decimal(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +870,7 @@ def get_big_double_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -912,7 +917,7 @@ def put_big_double_negative_decimal(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,7 +966,7 @@ def get_big_double_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1012,7 +1017,7 @@ def put_big_decimal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1060,7 +1065,7 @@ def get_big_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1107,7 +1112,7 @@ def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1156,7 +1161,7 @@ def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1203,7 +1208,7 @@ def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1252,7 +1257,7 @@ def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1303,7 +1308,7 @@ def put_small_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1351,7 +1356,7 @@ def get_small_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1402,7 +1407,7 @@ def put_small_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1450,7 +1455,7 @@ def get_small_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1501,7 +1506,7 @@ def put_small_decimal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1549,7 +1554,7 @@ def get_small_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py index 6b733a7f75f..4d4a8e2758a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_enum_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ build_put_referenced_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def get_not_expandable(self, **kwargs: Any) -> Union[str, _models.Colors]: :rtype: str or ~bodystring.models.Colors :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +121,7 @@ async def put_not_expandable( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ async def get_referenced(self, **kwargs: Any) -> Union[str, _models.Colors]: :rtype: str or ~bodystring.models.Colors :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +221,7 @@ async def put_referenced( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -264,7 +269,7 @@ async def get_referenced_constant(self, **kwargs: Any) -> _models.RefColorConsta :rtype: ~bodystring.models.RefColorConstant :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +320,7 @@ async def put_referenced_constant( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py index b42d4d566de..a1ee2062b79 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_string_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -40,6 +41,10 @@ build_put_whitespace_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ async def get_null(self, **kwargs: Any) -> Optional[str]: :rtype: str or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,7 +127,7 @@ async def put_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -173,7 +178,7 @@ async def get_empty(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,7 +225,7 @@ async def put_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +274,7 @@ async def get_mbcs(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -316,7 +321,7 @@ async def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +374,7 @@ async def get_whitespace(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +423,7 @@ async def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +474,7 @@ async def get_not_provided(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -516,7 +521,7 @@ async def get_base64_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -563,7 +568,7 @@ async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -614,7 +619,7 @@ async def put_base64_url_encoded( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +667,7 @@ async def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: :rtype: bytes or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py index fadd2eb959a..64d22f7a987 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_enum_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -154,7 +159,7 @@ def get_not_expandable(self, **kwargs: Any) -> Union[str, _models.Colors]: :rtype: str or ~bodystring.models.Colors :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +211,7 @@ def put_not_expandable( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +259,7 @@ def get_referenced(self, **kwargs: Any) -> Union[str, _models.Colors]: :rtype: str or ~bodystring.models.Colors :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +311,7 @@ def put_referenced( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -354,7 +359,7 @@ def get_referenced_constant(self, **kwargs: Any) -> _models.RefColorConstant: :rtype: ~bodystring.models.RefColorConstant :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +410,7 @@ def put_referenced_constant( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py index e94d76b1ec7..283a9e663ac 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -264,7 +269,7 @@ def get_null(self, **kwargs: Any) -> Optional[str]: :rtype: str or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +320,7 @@ def put_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -366,7 +371,7 @@ def get_empty(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +418,7 @@ def put_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -462,7 +467,7 @@ def get_mbcs(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -509,7 +514,7 @@ def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +567,7 @@ def get_whitespace(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -611,7 +616,7 @@ def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +667,7 @@ def get_not_provided(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,7 +714,7 @@ def get_base64_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -756,7 +761,7 @@ def get_base64_url_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +812,7 @@ def put_base64_url_encoded( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -855,7 +860,7 @@ def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: :rtype: bytes or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py index 85c925b6578..447e5daedd2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_time_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._time_operations import build_get_request, build_put_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def get(self, **kwargs: Any) -> datetime.time: :rtype: ~datetime.time :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +112,7 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py index 3df5a16f6b9..2aa93fd9b29 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_time_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,7 @@ def get(self, **kwargs: Any) -> datetime.time: :rtype: ~datetime.time :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +146,7 @@ def put(self, time_body: datetime.time, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_client_with_enum_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_client_with_enum_operations.py index 35a005c6302..894e195b1db 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_client_with_enum_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_client_with_enum_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ...operations._client_with_enum_operations import build_head_request from .._vendor import ClientWithEnumMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_client_with_enum_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_client_with_enum_operations.py index ed70fa78c66..ffe4635b1e7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_client_with_enum_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_client_with_enum_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import ClientWithEnumMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py index 7e4fcd4a146..db3d8099d93 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_contants_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -44,6 +45,10 @@ build_put_no_model_as_string_required_two_value_no_default_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ async def put_no_model_as_string_no_required_two_value_no_default( # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +137,7 @@ async def put_no_model_as_string_no_required_two_value_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +186,7 @@ async def put_no_model_as_string_no_required_one_value_no_default( # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,7 +235,7 @@ async def put_no_model_as_string_no_required_one_value_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -279,7 +284,7 @@ async def put_no_model_as_string_required_two_value_no_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -328,7 +333,7 @@ async def put_no_model_as_string_required_two_value_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -375,7 +380,7 @@ async def put_no_model_as_string_required_one_value_no_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +428,7 @@ async def put_no_model_as_string_required_one_value_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,7 +478,7 @@ async def put_model_as_string_no_required_two_value_no_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,7 +527,7 @@ async def put_model_as_string_no_required_two_value_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +576,7 @@ async def put_model_as_string_no_required_one_value_no_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +625,7 @@ async def put_model_as_string_no_required_one_value_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -669,7 +674,7 @@ async def put_model_as_string_required_two_value_no_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +723,7 @@ async def put_model_as_string_required_two_value_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -767,7 +772,7 @@ async def put_model_as_string_required_one_value_no_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,7 +821,7 @@ async def put_model_as_string_required_one_value_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -860,7 +865,7 @@ async def put_client_constants(self, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py index 8b761265928..8e59a3e773a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_contants_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -326,7 +331,7 @@ def put_no_model_as_string_no_required_two_value_no_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -375,7 +380,7 @@ def put_no_model_as_string_no_required_two_value_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +429,7 @@ def put_no_model_as_string_no_required_one_value_no_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -473,7 +478,7 @@ def put_no_model_as_string_no_required_one_value_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,7 +527,7 @@ def put_no_model_as_string_required_two_value_no_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +576,7 @@ def put_no_model_as_string_required_two_value_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -618,7 +623,7 @@ def put_no_model_as_string_required_one_value_no_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -666,7 +671,7 @@ def put_no_model_as_string_required_one_value_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +721,7 @@ def put_model_as_string_no_required_two_value_no_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +770,7 @@ def put_model_as_string_no_required_two_value_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -814,7 +819,7 @@ def put_model_as_string_no_required_one_value_no_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -863,7 +868,7 @@ def put_model_as_string_no_required_one_value_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -912,7 +917,7 @@ def put_model_as_string_required_two_value_no_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,7 +966,7 @@ def put_model_as_string_required_two_value_default( # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1010,7 +1015,7 @@ def put_model_as_string_required_one_value_no_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1059,7 +1064,7 @@ def put_model_as_string_required_one_value_default( # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1103,7 +1108,7 @@ def put_client_constants(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py index 31254481a52..9bc8bf896e1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_paths_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._paths_operations import build_get_empty_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def get_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py index 75be5c6e196..470325040a6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,7 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py index fec99145eeb..21239a0c989 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_paths_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._vendor import _convert_request from ...operations._paths_operations import build_get_empty_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,7 @@ async def get_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py index a5915f67346..846b2c27f14 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_paths_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +102,7 @@ def get_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_error_with_secrets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_error_with_secrets_operations.py index fb6125bc067..89645388b55 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_error_with_secrets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_error_with_secrets_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ ) from .._vendor import ErrorWithSecretsMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ async def create_secret(self, **kwargs: Any) -> _models.SecretResponse: :rtype: ~errorwithsecrets.models.SecretResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +94,7 @@ async def get_error_with_secrets(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_error_with_secrets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_error_with_secrets_operations.py index 71b7d5524bf..a9e787dea9a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_error_with_secrets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_error_with_secrets_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import ErrorWithSecretsMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,7 @@ def create_secret(self, **kwargs: Any) -> _models.SecretResponse: :rtype: ~errorwithsecrets.models.SecretResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +122,7 @@ def get_error_with_secrets(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py index 16c0dbd0dc3..fc4893d2244 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_pet_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._pet_operations import build_add_pet_request, build_get_by_pet_id_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> _models.Pet: :rtype: ~extensibleenumsswagger.models.Pet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +146,7 @@ async def add_pet(self, pet_param: Optional[Union[_models.Pet, IO[bytes]]] = Non :rtype: ~extensibleenumsswagger.models.Pet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py index 3a7ac57bf31..b76d3d93158 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_pet_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> _models.Pet: :rtype: ~extensibleenumsswagger.models.Pet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ def add_pet(self, pet_param: Optional[Union[_models.Pet, IO[bytes]]] = None, **k :rtype: ~extensibleenumsswagger.models.Pet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py index 4abe967acc7..0e05aea8dd6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_header_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -56,6 +57,10 @@ build_response_string_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,7 @@ async def param_existing_key( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,7 +141,7 @@ async def response_existing_key(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +187,7 @@ async def param_protected_key(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +232,7 @@ async def response_protected_key(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +286,7 @@ async def param_integer( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +336,7 @@ async def response_integer( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +391,7 @@ async def param_long( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,7 +441,7 @@ async def response_long( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +496,7 @@ async def param_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -541,7 +546,7 @@ async def response_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -596,7 +601,7 @@ async def param_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -646,7 +651,7 @@ async def response_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,7 +706,7 @@ async def param_bool( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -751,7 +756,7 @@ async def response_bool( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +812,7 @@ async def param_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +862,7 @@ async def response_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -911,7 +916,7 @@ async def param_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -960,7 +965,7 @@ async def response_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1015,7 +1020,7 @@ async def param_datetime( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1064,7 +1069,7 @@ async def response_datetime( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1124,7 @@ async def param_datetime_rfc1123( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1169,7 +1174,7 @@ async def response_datetime_rfc1123( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1222,7 +1227,7 @@ async def param_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1276,7 @@ async def response_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1324,7 +1329,7 @@ async def param_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1373,7 +1378,7 @@ async def response_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1429,7 +1434,7 @@ async def param_enum( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1479,7 +1484,7 @@ async def response_enum( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1527,7 +1532,7 @@ async def custom_request_id(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py index b89eb1735af..2b4adc3891b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_header_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -518,7 +523,7 @@ def param_existing_key( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +567,7 @@ def response_existing_key(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -608,7 +613,7 @@ def param_protected_key(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -653,7 +658,7 @@ def response_protected_key(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -707,7 +712,7 @@ def param_integer( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -755,7 +760,7 @@ def response_integer(self, scenario: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -810,7 +815,7 @@ def param_long( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -858,7 +863,7 @@ def response_long(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -913,7 +918,7 @@ def param_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,7 +966,7 @@ def response_float(self, scenario: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1016,7 +1021,7 @@ def param_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1064,7 +1069,7 @@ def response_double(self, scenario: str, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1124,7 @@ def param_bool( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1167,7 +1172,7 @@ def response_bool(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1223,7 +1228,7 @@ def param_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1276,7 @@ def response_string(self, scenario: str, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1325,7 +1330,7 @@ def param_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1372,7 +1377,7 @@ def response_date(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1427,7 +1432,7 @@ def param_datetime( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1474,7 +1479,7 @@ def response_datetime(self, scenario: str, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1529,7 +1534,7 @@ def param_datetime_rfc1123( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1579,7 +1584,7 @@ def response_datetime_rfc1123( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1632,7 +1637,7 @@ def param_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1679,7 +1684,7 @@ def response_duration(self, scenario: str, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1732,7 +1737,7 @@ def param_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1779,7 +1784,7 @@ def response_byte(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1835,7 +1840,7 @@ def param_enum( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1883,7 +1888,7 @@ def response_enum(self, scenario: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1931,7 +1936,7 @@ def custom_request_id(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py index 7a27e917ac8..47592529acf 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_client_failure_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -53,6 +54,10 @@ build_put413_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ async def head400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,7 +132,7 @@ async def get400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,7 +175,7 @@ async def options400(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +223,7 @@ async def put400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +279,7 @@ async def patch400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -330,7 +335,7 @@ async def post400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +391,7 @@ async def delete400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +442,7 @@ async def head401(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +485,7 @@ async def get402(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -523,7 +528,7 @@ async def options403(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +571,7 @@ async def get403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -614,7 +619,7 @@ async def put404( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +675,7 @@ async def patch405( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -726,7 +731,7 @@ async def post406( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,7 +787,7 @@ async def delete407( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -838,7 +843,7 @@ async def put409( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +894,7 @@ async def head410(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -932,7 +937,7 @@ async def get411(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -975,7 +980,7 @@ async def options412(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1018,7 +1023,7 @@ async def get412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1066,7 +1071,7 @@ async def put413( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1122,7 +1127,7 @@ async def patch414( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1178,7 +1183,7 @@ async def post415( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1229,7 +1234,7 @@ async def get416(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1277,7 +1282,7 @@ async def delete417( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1328,7 +1333,7 @@ async def head429(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py index d20884d7fdc..7477da622c9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_failure_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_get_no_model_error_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def get_empty_error(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +112,7 @@ async def get_no_model_error(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,7 +158,7 @@ async def get_no_model_empty(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py index f4fdae81d52..db535692f02 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_redirects_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -43,6 +44,10 @@ build_put307_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,7 @@ async def head300(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: :rtype: list[str] or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -173,7 +178,7 @@ async def head301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,7 +225,7 @@ async def get301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +278,7 @@ async def put301( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,7 +332,7 @@ async def head302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -374,7 +379,7 @@ async def get302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +432,7 @@ async def patch302( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,7 +492,7 @@ async def post303( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +547,7 @@ async def head307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +594,7 @@ async def get307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +641,7 @@ async def options307(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -688,7 +693,7 @@ async def put307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -748,7 +753,7 @@ async def patch307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -808,7 +813,7 @@ async def post307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -868,7 +873,7 @@ async def delete307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py index f3c41741259..bf37d0efdbe 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_retry_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -36,6 +37,10 @@ build_put504_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +72,7 @@ async def head408(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +120,7 @@ async def put500( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +176,7 @@ async def patch500( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ async def get502(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -265,7 +270,7 @@ async def options502(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +322,7 @@ async def post503( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +378,7 @@ async def delete503( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,7 +434,7 @@ async def put504( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +490,7 @@ async def patch504( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py index 555de71ab74..09e7fd5758d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_server_failure_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ build_post505_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +67,7 @@ async def head501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +110,7 @@ async def get501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,7 +158,7 @@ async def post505( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ async def delete505( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py index 99d280ddfbc..84896e6dd48 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,6 +47,10 @@ build_put204_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,7 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +125,7 @@ async def get200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +172,7 @@ async def options200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +224,7 @@ async def put200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +280,7 @@ async def patch200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +336,7 @@ async def post200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -387,7 +392,7 @@ async def delete200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -443,7 +448,7 @@ async def put201( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +504,7 @@ async def post201( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +560,7 @@ async def put202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -611,7 +616,7 @@ async def patch202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +672,7 @@ async def post202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -723,7 +728,7 @@ async def delete202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +779,7 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -822,7 +827,7 @@ async def put204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -878,7 +883,7 @@ async def patch204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -934,7 +939,7 @@ async def post204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +995,7 @@ async def delete204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1041,7 +1046,7 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py index 61e6cd073b0..fc432aa70a9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_multiple_responses_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -60,6 +61,10 @@ build_get_default_none400_none_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +98,7 @@ async def get200_model204_no_model_default_error200_valid( # pylint: disable=na :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +149,7 @@ async def get200_model204_no_model_default_error204_valid( # pylint: disable=na :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +200,7 @@ async def get200_model204_no_model_default_error201_invalid( # pylint: disable= :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +251,7 @@ async def get200_model204_no_model_default_error202_none( # pylint: disable=nam :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,7 +302,7 @@ async def get200_model204_no_model_default_error400_valid( # pylint: disable=na :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +353,7 @@ async def get200_model201_model_default_error200_valid( # pylint: disable=name- :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,7 +406,7 @@ async def get200_model201_model_default_error201_valid( # pylint: disable=name- :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,7 +459,7 @@ async def get200_model201_model_default_error400_valid( # pylint: disable=name- :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +513,7 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid( # pylint ~httpinfrastructure.models.D :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -565,7 +570,7 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid( # pylint ~httpinfrastructure.models.D :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +627,7 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid( # pylint ~httpinfrastructure.models.D :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,7 +684,7 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid( # pylint ~httpinfrastructure.models.D :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +740,7 @@ async def get202_none204_none_default_error202_none( # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -780,7 +785,7 @@ async def get202_none204_none_default_error204_none( # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -825,7 +830,7 @@ async def get202_none204_none_default_error400_valid( # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -870,7 +875,7 @@ async def get202_none204_none_default_none202_invalid( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -914,7 +919,7 @@ async def get202_none204_none_default_none204_none( # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -958,7 +963,7 @@ async def get202_none204_none_default_none400_none( # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1002,7 +1007,7 @@ async def get202_none204_none_default_none400_invalid( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1044,7 +1049,7 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> _models.MyExcepti :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1090,7 +1095,7 @@ async def get_default_model_a200_none(self, **kwargs: Any) -> _models.MyExceptio :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1138,7 +1143,7 @@ async def get_default_model_a400_valid( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1183,7 +1188,7 @@ async def get_default_model_a400_none( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1228,7 +1233,7 @@ async def get_default_none200_invalid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1270,7 +1275,7 @@ async def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,7 +1319,7 @@ async def get_default_none400_invalid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1356,7 +1361,7 @@ async def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1399,7 +1404,7 @@ async def get200_model_a200_none(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1445,7 +1450,7 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1491,7 +1496,7 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1537,7 +1542,7 @@ async def get200_model_a400_none(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1583,7 +1588,7 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1629,7 +1634,7 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1675,7 +1680,7 @@ async def get200_model_a202_valid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py index 3b5add89fca..d75d6d01e28 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_client_failure_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -463,7 +468,7 @@ def head400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -506,7 +511,7 @@ def get400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -549,7 +554,7 @@ def options400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +602,7 @@ def put400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -653,7 +658,7 @@ def patch400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,7 +714,7 @@ def post400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +770,7 @@ def delete400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,7 +821,7 @@ def head401(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -859,7 +864,7 @@ def get402(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -902,7 +907,7 @@ def options403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -945,7 +950,7 @@ def get403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -993,7 +998,7 @@ def put404( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1049,7 +1054,7 @@ def patch405( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1105,7 +1110,7 @@ def post406( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1161,7 +1166,7 @@ def delete407( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1217,7 +1222,7 @@ def put409( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1268,7 +1273,7 @@ def head410(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1311,7 +1316,7 @@ def get411(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1354,7 +1359,7 @@ def options412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1397,7 +1402,7 @@ def get412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1445,7 +1450,7 @@ def put413( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1501,7 +1506,7 @@ def patch414( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1557,7 +1562,7 @@ def post415( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1608,7 +1613,7 @@ def get416(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1656,7 +1661,7 @@ def delete417( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1707,7 +1712,7 @@ def head429(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py index 37cbb34bce1..b64355798c4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_failure_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -102,7 +107,7 @@ def get_empty_error(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +154,7 @@ def get_no_model_error(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +200,7 @@ def get_no_model_empty(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py index 51afdf5e0f8..4460394152a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_redirects_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -305,7 +310,7 @@ def head300(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,7 +357,7 @@ def get300(self, **kwargs: Any) -> Optional[List[str]]: :rtype: list[str] or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -404,7 +409,7 @@ def head301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -451,7 +456,7 @@ def get301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +509,7 @@ def put301( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -558,7 +563,7 @@ def head302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -605,7 +610,7 @@ def get302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -658,7 +663,7 @@ def patch302( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +723,7 @@ def post303( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,7 +778,7 @@ def head307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -820,7 +825,7 @@ def get307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -867,7 +872,7 @@ def options307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -919,7 +924,7 @@ def put307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -979,7 +984,7 @@ def patch307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1039,7 +1044,7 @@ def post307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1099,7 +1104,7 @@ def delete307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py index e88a3d3c9bb..4ffd0a08c7c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_retry_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -204,7 +209,7 @@ def head408(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +257,7 @@ def put500( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +313,7 @@ def patch500( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +364,7 @@ def get502(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,7 +407,7 @@ def options502(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,7 +459,7 @@ def post503( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +515,7 @@ def delete503( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +571,7 @@ def put504( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +627,7 @@ def patch504( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py index 709211db367..c685625fba6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_server_failure_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -122,7 +127,7 @@ def head501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +170,7 @@ def get501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +218,7 @@ def post505( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +274,7 @@ def delete505( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py index c01a79c2fa8..0833c794138 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_http_success_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -368,7 +373,7 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +416,7 @@ def get200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -458,7 +463,7 @@ def options200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +515,7 @@ def put200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +571,7 @@ def patch200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +627,7 @@ def post200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -678,7 +683,7 @@ def delete200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -734,7 +739,7 @@ def put201( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -790,7 +795,7 @@ def post201( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -846,7 +851,7 @@ def put202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -902,7 +907,7 @@ def patch202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -958,7 +963,7 @@ def post202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1014,7 +1019,7 @@ def delete202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1065,7 +1070,7 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1113,7 +1118,7 @@ def put204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1169,7 +1174,7 @@ def patch204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1225,7 +1230,7 @@ def post204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1281,7 +1286,7 @@ def delete204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1332,7 +1337,7 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py index 38cd20abdc2..2e6effc07f3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_multiple_responses_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -520,7 +525,7 @@ def get200_model204_no_model_default_error200_valid( # pylint: disable=name-too :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +576,7 @@ def get200_model204_no_model_default_error204_valid( # pylint: disable=name-too :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +627,7 @@ def get200_model204_no_model_default_error201_invalid( # pylint: disable=name-t :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -673,7 +678,7 @@ def get200_model204_no_model_default_error202_none( # pylint: disable=name-too- :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -724,7 +729,7 @@ def get200_model204_no_model_default_error400_valid( # pylint: disable=name-too :rtype: ~httpinfrastructure.models.MyException or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +780,7 @@ def get200_model201_model_default_error200_valid( # pylint: disable=name-too-lo :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -828,7 +833,7 @@ def get200_model201_model_default_error201_valid( # pylint: disable=name-too-lo :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -881,7 +886,7 @@ def get200_model201_model_default_error400_valid( # pylint: disable=name-too-lo :rtype: ~httpinfrastructure.models.MyException or ~httpinfrastructure.models.B :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -935,7 +940,7 @@ def get200_model_a201_model_c404_model_d_default_error200_valid( # pylint: disa ~httpinfrastructure.models.D :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -992,7 +997,7 @@ def get200_model_a201_model_c404_model_d_default_error201_valid( # pylint: disa ~httpinfrastructure.models.D :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1049,7 +1054,7 @@ def get200_model_a201_model_c404_model_d_default_error404_valid( # pylint: disa ~httpinfrastructure.models.D :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1111,7 @@ def get200_model_a201_model_c404_model_d_default_error400_valid( # pylint: disa ~httpinfrastructure.models.D :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1162,7 +1167,7 @@ def get202_none204_none_default_error202_none( # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1207,7 +1212,7 @@ def get202_none204_none_default_error204_none( # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1252,7 +1257,7 @@ def get202_none204_none_default_error400_valid( # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1297,7 +1302,7 @@ def get202_none204_none_default_none202_invalid( # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1341,7 +1346,7 @@ def get202_none204_none_default_none204_none( # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1385,7 +1390,7 @@ def get202_none204_none_default_none400_none( # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1429,7 +1434,7 @@ def get202_none204_none_default_none400_invalid( # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1471,7 +1476,7 @@ def get_default_model_a200_valid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1517,7 +1522,7 @@ def get_default_model_a200_none(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1563,7 +1568,7 @@ def get_default_model_a400_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1606,7 +1611,7 @@ def get_default_model_a400_none(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1649,7 +1654,7 @@ def get_default_none200_invalid(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1691,7 +1696,7 @@ def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1733,7 +1738,7 @@ def get_default_none400_invalid(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1775,7 +1780,7 @@ def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1818,7 +1823,7 @@ def get200_model_a200_none(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1864,7 +1869,7 @@ def get200_model_a200_valid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1910,7 +1915,7 @@ def get200_model_a200_invalid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1956,7 +1961,7 @@ def get200_model_a400_none(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2002,7 +2007,7 @@ def get200_model_a400_valid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2048,7 +2053,7 @@ def get200_model_a400_invalid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2094,7 +2099,7 @@ def get200_model_a202_valid(self, **kwargs: Any) -> _models.MyException: :rtype: ~httpinfrastructure.models.MyException :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py index 08b7f6c6ff2..5a662fe2459 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_incorrect_returned_error_model_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ...operations._incorrect_returned_error_model_operations import build_get_incorrect_error_from_server_request from .._vendor import IncorrectReturnedErrorModelMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ async def get_incorrect_error_from_server( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py index 49dff381d6b..5ec03add982 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_incorrect_returned_error_model_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import IncorrectReturnedErrorModelMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def get_incorrect_error_from_server(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_media_types_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_media_types_client_operations.py index aca25dd336a..3cda0530234 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_media_types_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_media_types_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -36,6 +37,10 @@ ) from .._vendor import MediaTypesClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ async def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes] :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,7 +192,7 @@ async def analyze_body_no_accept_header( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +251,7 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +308,7 @@ async def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +363,7 @@ async def binary_body_with_three_content_types(self, message: IO[bytes], **kwarg :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +432,7 @@ async def _body_three_types(self, message: Union[Any, IO[bytes], str], **kwargs: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +493,7 @@ async def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_media_types_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_media_types_client_operations.py index df621168c09..fc63eb6e197 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_media_types_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_media_types_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import MediaTypesClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -199,7 +204,7 @@ def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes]]] = N :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +306,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +365,7 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +422,7 @@ def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: Any) :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +477,7 @@ def binary_body_with_three_content_types(self, message: IO[bytes], **kwargs: Any :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -541,7 +546,7 @@ def _body_three_types(self, message: Union[Any, IO[bytes], str], **kwargs: Any) :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -602,7 +607,7 @@ def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py index a18080ea141..897d99a8825 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_media_types_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -36,6 +37,10 @@ ) from .._vendor import MediaTypesClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ async def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes] :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -187,7 +192,7 @@ async def analyze_body_no_accept_header( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +251,7 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +308,7 @@ async def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +363,7 @@ async def binary_body_with_three_content_types(self, message: IO[bytes], **kwarg :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -464,7 +469,7 @@ async def body_three_types(self, message: Union[Any, IO[bytes], str], **kwargs: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -525,7 +530,7 @@ async def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py index 40b93d3d4cf..b0e9cab956c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_media_types_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import MediaTypesClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -199,7 +204,7 @@ def analyze_body(self, input: Optional[Union[_models.SourcePath, IO[bytes]]] = N :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +306,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +365,7 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +422,7 @@ def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: Any) :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +477,7 @@ def binary_body_with_three_content_types(self, message: IO[bytes], **kwargs: Any :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,7 +583,7 @@ def body_three_types(self, message: Union[Any, IO[bytes], str], **kwargs: Any) - :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,7 +644,7 @@ def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py index 8f65785bd56..847eba28771 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_merge_patch_json_client_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -47,7 +47,7 @@ async def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py index 15244b5a878..ab09c1cde5d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_merge_patch_json_client_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -66,7 +66,7 @@ def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py index 66d72c6503f..3c6c1858235 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_auto_rest_resource_flattening_test_service_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -40,6 +41,10 @@ ) from .._vendor import AutoRestResourceFlatteningTestServiceMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -105,7 +110,7 @@ async def put_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +171,7 @@ async def get_array(self, **kwargs: Any) -> List[_models.FlattenedProduct]: :rtype: list[~modelflattening.models.FlattenedProduct] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +271,7 @@ async def put_wrapped_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -328,7 +333,7 @@ async def get_wrapped_array(self, **kwargs: Any) -> List[_models.ProductWrapper] :rtype: list[~modelflattening.models.ProductWrapper] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -425,7 +430,7 @@ async def put_dictionary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,7 +491,7 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, _models.FlattenedProd :rtype: dict[str, ~modelflattening.models.FlattenedProduct] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +594,7 @@ async def put_resource_collection( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -650,7 +655,7 @@ async def get_resource_collection(self, **kwargs: Any) -> _models.ResourceCollec :rtype: ~modelflattening.models.ResourceCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -747,7 +752,7 @@ async def put_simple_product( :rtype: ~modelflattening.models.SimpleProduct :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,7 +841,7 @@ async def post_flattened_simple_product( :rtype: ~modelflattening.models.SimpleProduct :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -906,7 +911,7 @@ async def put_simple_product_with_grouping( :rtype: ~modelflattening.models.SimpleProduct :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py index 7cf01d6ed1b..3210224ad36 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_auto_rest_resource_flattening_test_service_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import AutoRestResourceFlatteningTestServiceMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -277,7 +282,7 @@ def put_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,7 +343,7 @@ def get_array(self, **kwargs: Any) -> List[_models.FlattenedProduct]: :rtype: list[~modelflattening.models.FlattenedProduct] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +443,7 @@ def put_wrapped_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -500,7 +505,7 @@ def get_wrapped_array(self, **kwargs: Any) -> List[_models.ProductWrapper]: :rtype: list[~modelflattening.models.ProductWrapper] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +602,7 @@ def put_dictionary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -658,7 +663,7 @@ def get_dictionary(self, **kwargs: Any) -> Dict[str, _models.FlattenedProduct]: :rtype: dict[str, ~modelflattening.models.FlattenedProduct] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -761,7 +766,7 @@ def put_resource_collection( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -822,7 +827,7 @@ def get_resource_collection(self, **kwargs: Any) -> _models.ResourceCollection: :rtype: ~modelflattening.models.ResourceCollection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -919,7 +924,7 @@ def put_simple_product( :rtype: ~modelflattening.models.SimpleProduct :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1008,7 +1013,7 @@ def post_flattened_simple_product( :rtype: ~modelflattening.models.SimpleProduct :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1078,7 +1083,7 @@ def put_simple_product_with_grouping( :rtype: ~modelflattening.models.SimpleProduct :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py index 56ba573e9a0..865d3dcfb35 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_multiple_inheritance_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -39,6 +40,10 @@ ) from .._vendor import MultipleInheritanceServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ async def get_horse(self, **kwargs: Any) -> _models.Horse: :rtype: ~multipleinheritance.models.Horse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +137,7 @@ async def put_horse(self, horse: Union[_models.Horse, IO[bytes]], **kwargs: Any) :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +195,7 @@ async def get_pet(self, **kwargs: Any) -> _models.Pet: :rtype: ~multipleinheritance.models.Pet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +244,7 @@ async def put_pet(self, name: str, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -291,7 +296,7 @@ async def get_feline(self, **kwargs: Any) -> _models.Feline: :rtype: ~multipleinheritance.models.Feline :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +374,7 @@ async def put_feline(self, feline: Union[_models.Feline, IO[bytes]], **kwargs: A :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +432,7 @@ async def get_cat(self, **kwargs: Any) -> _models.Cat: :rtype: ~multipleinheritance.models.Cat :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +512,7 @@ async def put_cat(self, cat: Union[_models.Cat, IO[bytes]], **kwargs: Any) -> st :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -566,7 +571,7 @@ async def get_kitten(self, **kwargs: Any) -> _models.Kitten: :rtype: ~multipleinheritance.models.Kitten :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +654,7 @@ async def put_kitten(self, kitten: Union[_models.Kitten, IO[bytes]], **kwargs: A :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py index d93d1084028..c27c55d2e9b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import MultipleInheritanceServiceClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -200,7 +205,7 @@ def get_horse(self, **kwargs: Any) -> _models.Horse: :rtype: ~multipleinheritance.models.Horse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +283,7 @@ def put_horse(self, horse: Union[_models.Horse, IO[bytes]], **kwargs: Any) -> st :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,7 +341,7 @@ def get_pet(self, **kwargs: Any) -> _models.Pet: :rtype: ~multipleinheritance.models.Pet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +390,7 @@ def put_pet(self, name: str, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +442,7 @@ def get_feline(self, **kwargs: Any) -> _models.Feline: :rtype: ~multipleinheritance.models.Feline :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +520,7 @@ def put_feline(self, feline: Union[_models.Feline, IO[bytes]], **kwargs: Any) -> :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -573,7 +578,7 @@ def get_cat(self, **kwargs: Any) -> _models.Cat: :rtype: ~multipleinheritance.models.Cat :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -653,7 +658,7 @@ def put_cat(self, cat: Union[_models.Cat, IO[bytes]], **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -712,7 +717,7 @@ def get_kitten(self, **kwargs: Any) -> _models.Kitten: :rtype: ~multipleinheritance.models.Kitten :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -795,7 +800,7 @@ def put_kitten(self, kitten: Union[_models.Kitten, IO[bytes]], **kwargs: Any) -> :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py index 80d12fc9655..68bf635cf8a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_float_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._float_operations import build_get_request, build_put_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def put(self, input: Optional[Union[float, _models.FloatEnum]] = None, **k :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ async def get(self, **kwargs: Any) -> Union[float, _models.FloatEnum]: :rtype: float or ~nonstringenums.models.FloatEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations_operations.py index 79a664e3917..2cc594802b6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_int_operations_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._int_operations_operations import build_get_request, build_put_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def put(self, input: Optional[Union[int, _models.IntEnum]] = None, **kwarg :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ async def get(self, **kwargs: Any) -> Union[int, _models.IntEnum]: :rtype: int or ~nonstringenums.models.IntEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py index 51679f48964..099418af4f2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_float_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,7 @@ def put(self, input: Optional[Union[float, _models.FloatEnum]] = None, **kwargs: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +151,7 @@ def get(self, **kwargs: Any) -> Union[float, _models.FloatEnum]: :rtype: float or ~nonstringenums.models.FloatEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations_operations.py index d29485be4e4..4f03dc0e17d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_int_operations_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,7 @@ def put(self, input: Optional[Union[int, _models.IntEnum]] = None, **kwargs: Any :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +151,7 @@ def get(self, **kwargs: Any) -> Union[int, _models.IntEnum]: :rtype: int or ~nonstringenums.models.IntEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py index fe38e6d279a..67836765488 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_object_type_client_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,7 +46,7 @@ async def get(self, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,7 +97,7 @@ async def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py index 3326d06534e..b2716f1c919 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_object_type_client_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -79,7 +79,7 @@ def get(self, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +130,7 @@ def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py index dcfbb0a8a37..d12850400fa 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_anything_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ ) from .._vendor import AnythingClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,7 @@ async def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +101,7 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -143,7 +148,7 @@ async def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +197,7 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +244,7 @@ async def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +293,7 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py index 4c3afb09dfd..978d2a14679 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_anything_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import AnythingClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -126,7 +131,7 @@ def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +180,7 @@ def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +276,7 @@ def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,7 +323,7 @@ def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -367,7 +372,7 @@ def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py index 7c11d879ccc..905e75e3b53 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_availability_sets_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._availability_sets_operations import build_update_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,7 @@ async def update( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py index 2bf64852bcc..fbf104dcb0d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_availability_sets_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +93,7 @@ def update( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py index 07d7d3f532b..85c197daed0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_parmaterized_endpoint_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ...operations._parmaterized_endpoint_client_operations import build_get_request from .._vendor import ParmaterizedEndpointClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py index cd0d999c618..0251a7b4f66 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_parmaterized_endpoint_client_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import ParmaterizedEndpointClientMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,7 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py index 061a7a67ef3..c5cc6b74137 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_auto_rest_report_service_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ ) from .._vendor import AutoRestReportServiceMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ async def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Di :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +103,7 @@ async def get_optional_report(self, qualifier: Optional[str] = None, **kwargs: A :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py index c0c90411a3b..a4e3dc235c5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_auto_rest_report_service_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import AutoRestReportServiceMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ def get_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[str :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,7 +141,7 @@ def get_optional_report(self, qualifier: Optional[str] = None, **kwargs: Any) -> :rtype: dict[str, int] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py index 4ccfda15143..d6657feda81 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_explicit_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -52,6 +53,10 @@ build_put_required_binary_body_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +92,7 @@ async def put_optional_binary_body( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +144,7 @@ async def put_required_binary_body( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +197,7 @@ async def post_required_integer_parameter( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +249,7 @@ async def post_optional_integer_parameter( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +305,7 @@ async def post_required_integer_property( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +358,7 @@ async def post_optional_integer_property( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +415,7 @@ async def post_required_integer_header( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -458,7 +463,7 @@ async def post_optional_integer_header( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +512,7 @@ async def post_required_string_parameter( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -559,7 +564,7 @@ async def post_optional_string_parameter( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -615,7 +620,7 @@ async def post_required_string_property( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -668,7 +673,7 @@ async def post_optional_string_property( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -725,7 +730,7 @@ async def post_required_string_header( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,7 +778,7 @@ async def post_optional_string_header( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -856,7 +861,7 @@ async def post_required_class_parameter( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -947,7 +952,7 @@ async def post_optional_class_parameter( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1010,7 +1015,7 @@ async def post_required_class_property( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1063,7 +1068,7 @@ async def post_optional_class_property( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1154,7 +1159,7 @@ async def post_required_array_parameter( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1245,7 +1250,7 @@ async def post_optional_array_parameter( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1308,7 +1313,7 @@ async def post_required_array_property( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1361,7 +1366,7 @@ async def post_optional_array_property( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1418,7 +1423,7 @@ async def post_required_array_header( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1466,7 +1471,7 @@ async def post_optional_array_header( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py index ae75ffc7f48..322bc41c59a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_implicit_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, IO, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -35,6 +36,10 @@ build_put_optional_query_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,7 @@ async def get_required_path( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +123,7 @@ async def put_optional_query( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +171,7 @@ async def put_optional_header( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,7 +219,7 @@ async def put_optional_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +274,7 @@ async def put_optional_binary_body( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +322,7 @@ async def get_required_global_path(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +366,7 @@ async def get_required_global_query(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +410,7 @@ async def get_optional_global_query(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py index 42043c2b6c5..669edcff3d5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_explicit_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -482,7 +487,7 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +539,7 @@ def put_required_binary_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -587,7 +592,7 @@ def post_required_integer_parameter( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,7 +644,7 @@ def post_optional_integer_parameter( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -695,7 +700,7 @@ def post_required_integer_property( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -748,7 +753,7 @@ def post_optional_integer_property( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -805,7 +810,7 @@ def post_required_integer_header( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -853,7 +858,7 @@ def post_optional_integer_header( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -902,7 +907,7 @@ def post_required_string_parameter( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -954,7 +959,7 @@ def post_optional_string_parameter( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1010,7 +1015,7 @@ def post_required_string_property( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1063,7 +1068,7 @@ def post_optional_string_property( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1120,7 +1125,7 @@ def post_required_string_header( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1168,7 +1173,7 @@ def post_optional_string_header( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1251,7 +1256,7 @@ def post_required_class_parameter( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1342,7 +1347,7 @@ def post_optional_class_parameter( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1405,7 +1410,7 @@ def post_required_class_property( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1458,7 +1463,7 @@ def post_optional_class_property( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1549,7 +1554,7 @@ def post_required_array_parameter( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1640,7 +1645,7 @@ def post_optional_array_parameter( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1703,7 +1708,7 @@ def post_required_array_property( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1756,7 +1761,7 @@ def post_optional_array_property( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1813,7 +1818,7 @@ def post_required_array_header( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1861,7 +1866,7 @@ def post_optional_array_header( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py index d54e0133c42..8a1fc1311fa 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_implicit_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, IO, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -210,7 +215,7 @@ def get_required_path( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +263,7 @@ def put_optional_query( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +311,7 @@ def put_optional_header( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -354,7 +359,7 @@ def put_optional_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +414,7 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +462,7 @@ def get_required_global_path(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -501,7 +506,7 @@ def get_required_global_query(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -545,7 +550,7 @@ def get_optional_global_query(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py index 7aae8feed24..80f0522c1a7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_import_operations_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -65,7 +65,7 @@ async def operation_one(self, parameter1: str, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py index 61c6b9e4940..9541880789b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_reserved_words_client_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -55,7 +55,7 @@ async def operation_with_content_param(self, content: IO[bytes], **kwargs: Any) :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +108,7 @@ async def operation_with_json_param(self, json: Any, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +163,7 @@ async def operation_with_data_param(self, data: str, world: str, **kwargs: Any) :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +224,7 @@ async def operation_with_files_param(self, files: IO[bytes], file_name: str, **k :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -290,7 +290,7 @@ async def operation_with_url( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +342,7 @@ async def reserved_enum(self, enum_parameter: Union[str, _models.MyEnum], **kwar :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py index 18e68e6cba3..96cc06cee8f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_import_operations_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -86,7 +86,7 @@ def operation_one(self, parameter1: str, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py index 0234749dd06..843bae8612b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_reserved_words_client_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -160,7 +160,7 @@ def operation_with_content_param(self, content: IO[bytes], **kwargs: Any) -> JSO :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +213,7 @@ def operation_with_json_param(self, json: Any, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +268,7 @@ def operation_with_data_param(self, data: str, world: str, **kwargs: Any) -> JSO :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +329,7 @@ def operation_with_files_param(self, files: IO[bytes], file_name: str, **kwargs: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +395,7 @@ def operation_with_url( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +447,7 @@ def reserved_enum(self, enum_parameter: Union[str, _models.MyEnum], **kwargs: An :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py index 101a5cc52e2..fe9ad109078 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_autorest_security_aad_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ...operations._autorest_security_aad_operations import build_head_request from .._vendor import AutorestSecurityAadMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py index 33455518465..cd2d524e4b0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_autorest_security_aad_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import AutorestSecurityAadMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,7 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_security_aad_swagger_credential_flag_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_security_aad_swagger_credential_flag_operations.py index 02ac9b75231..c7f9f6ffa3a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_security_aad_swagger_credential_flag_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_security_aad_swagger_credential_flag_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ...operations._security_aad_swagger_credential_flag_operations import build_head_request from .._vendor import SecurityAadSwaggerCredentialFlagMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_security_aad_swagger_credential_flag_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_security_aad_swagger_credential_flag_operations.py index 3ea09ea817b..c40438dff5f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_security_aad_swagger_credential_flag_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_security_aad_swagger_credential_flag_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import SecurityAadSwaggerCredentialFlagMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +54,7 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py index fa3a557788b..9665c34c85a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_autorest_security_key_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ...operations._autorest_security_key_operations import build_head_request from .._vendor import AutorestSecurityKeyMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py index 9bdbc39d79f..a364c697844 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_autorest_security_key_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import AutorestSecurityKeyMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,7 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_security_key_swagger_credential_flag_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_security_key_swagger_credential_flag_operations.py index 9d5176413fb..712386a16d7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_security_key_swagger_credential_flag_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_security_key_swagger_credential_flag_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ...operations._security_key_swagger_credential_flag_operations import build_head_request from .._vendor import SecurityKeySwaggerCredentialFlagMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_security_key_swagger_credential_flag_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_security_key_swagger_credential_flag_operations.py index ca8d3bac2e0..b8822e502a6 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_security_key_swagger_credential_flag_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_security_key_swagger_credential_flag_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import SecurityKeySwaggerCredentialFlagMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +54,7 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py index 93ca2078b1c..62a1cb5ee11 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_path_items_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_get_local_path_item_query_null_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,7 @@ async def get_all_with_values( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,7 +153,7 @@ async def get_global_query_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +221,7 @@ async def get_global_and_local_query_null( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,7 +288,7 @@ async def get_local_path_item_query_null( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py index 91863e05faa..3aca9d7ca9c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_paths_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -54,6 +55,10 @@ build_unix_time_url_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ async def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +135,7 @@ async def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +180,7 @@ async def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ async def get_int_negative_one_million( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +272,7 @@ async def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -312,7 +317,7 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +362,7 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,7 +407,7 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +452,7 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +497,7 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +542,7 @@ async def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -582,7 +587,7 @@ async def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +634,7 @@ async def string_url_non_encoded(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -674,7 +679,7 @@ async def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -723,7 +728,7 @@ async def string_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -772,7 +777,7 @@ async def enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -821,7 +826,7 @@ async def enum_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +874,7 @@ async def byte_multi_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -913,7 +918,7 @@ async def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -962,7 +967,7 @@ async def byte_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1006,7 +1011,7 @@ async def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1056,7 +1061,7 @@ async def date_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1105,7 @@ async def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1149,7 +1154,7 @@ async def date_time_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1197,7 +1202,7 @@ async def base64_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1247,7 +1252,7 @@ async def array_csv_in_path( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1295,7 +1300,7 @@ async def unix_time_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py index c1efdb5218f..d8d55a2ecce 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_queries_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -63,6 +64,10 @@ build_string_url_encoded_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +99,7 @@ async def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +144,7 @@ async def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -188,7 +193,7 @@ async def get_boolean_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -232,7 +237,7 @@ async def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -279,7 +284,7 @@ async def get_int_negative_one_million( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -328,7 +333,7 @@ async def get_int_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +377,7 @@ async def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +422,7 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -466,7 +471,7 @@ async def get_long_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +515,7 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +560,7 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -604,7 +609,7 @@ async def float_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +653,7 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -693,7 +698,7 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -742,7 +747,7 @@ async def double_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -786,7 +791,7 @@ async def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -831,7 +836,7 @@ async def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -878,7 +883,7 @@ async def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -927,7 +932,7 @@ async def string_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -976,7 +981,7 @@ async def enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1025,7 +1030,7 @@ async def enum_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1074,7 +1079,7 @@ async def byte_multi_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1118,7 +1123,7 @@ async def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1167,7 +1172,7 @@ async def byte_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1211,7 +1216,7 @@ async def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1260,7 +1265,7 @@ async def date_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1304,7 +1309,7 @@ async def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1360,7 @@ async def date_time_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1405,7 +1410,7 @@ async def array_string_csv_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1453,7 +1458,7 @@ async def array_string_csv_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1502,7 +1507,7 @@ async def array_string_csv_empty( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1552,7 +1557,7 @@ async def array_string_no_collection_format_empty( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1602,7 +1607,7 @@ async def array_string_ssv_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1652,7 +1657,7 @@ async def array_string_tsv_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1702,7 +1707,7 @@ async def array_string_pipes_valid( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py index 400abf0c9e7..2773bb8ec5b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_path_items_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from msrest import Serializer @@ -27,6 +28,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -247,7 +252,7 @@ def get_all_with_values( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +320,7 @@ def get_global_query_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +388,7 @@ def get_global_and_local_query_null( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +455,7 @@ def get_local_path_item_query_null( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py index 9974992f0cc..035cc79e6b0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_paths_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -596,7 +601,7 @@ def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +646,7 @@ def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -686,7 +691,7 @@ def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,7 +736,7 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -776,7 +781,7 @@ def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -821,7 +826,7 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -866,7 +871,7 @@ def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -911,7 +916,7 @@ def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -956,7 +961,7 @@ def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1001,7 +1006,7 @@ def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1046,7 +1051,7 @@ def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1091,7 +1096,7 @@ def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1138,7 +1143,7 @@ def string_url_non_encoded(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1183,7 +1188,7 @@ def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1230,7 +1235,7 @@ def string_null(self, string_path: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1279,7 +1284,7 @@ def enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1328,7 +1333,7 @@ def enum_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1376,7 +1381,7 @@ def byte_multi_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1420,7 +1425,7 @@ def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1467,7 +1472,7 @@ def byte_null(self, byte_path: bytes, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1511,7 +1516,7 @@ def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1561,7 +1566,7 @@ def date_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1605,7 +1610,7 @@ def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1654,7 +1659,7 @@ def date_time_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1702,7 +1707,7 @@ def base64_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1752,7 +1757,7 @@ def array_csv_in_path( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1800,7 +1805,7 @@ def unix_time_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py index d278ac55f49..48c7e93b28d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_queries_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -736,7 +741,7 @@ def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -781,7 +786,7 @@ def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -830,7 +835,7 @@ def get_boolean_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -874,7 +879,7 @@ def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -919,7 +924,7 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -968,7 +973,7 @@ def get_int_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1012,7 +1017,7 @@ def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1057,7 +1062,7 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1111,7 @@ def get_long_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1150,7 +1155,7 @@ def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1195,7 +1200,7 @@ def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1244,7 +1249,7 @@ def float_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1288,7 +1293,7 @@ def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1333,7 +1338,7 @@ def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1382,7 +1387,7 @@ def double_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1426,7 +1431,7 @@ def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1471,7 +1476,7 @@ def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1518,7 +1523,7 @@ def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1567,7 +1572,7 @@ def string_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1616,7 +1621,7 @@ def enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1665,7 +1670,7 @@ def enum_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1714,7 +1719,7 @@ def byte_multi_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1758,7 +1763,7 @@ def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1807,7 +1812,7 @@ def byte_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1851,7 +1856,7 @@ def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1900,7 +1905,7 @@ def date_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1944,7 +1949,7 @@ def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1995,7 +2000,7 @@ def date_time_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2045,7 +2050,7 @@ def array_string_csv_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2093,7 +2098,7 @@ def array_string_csv_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2142,7 +2147,7 @@ def array_string_csv_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2192,7 +2197,7 @@ def array_string_no_collection_format_empty( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2242,7 +2247,7 @@ def array_string_ssv_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2292,7 +2297,7 @@ def array_string_tsv_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2342,7 +2347,7 @@ def array_string_pipes_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py index 21b5699de45..3d5ae26e52f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_queries_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_array_string_multi_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,7 @@ async def array_string_multi_null( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +118,7 @@ async def array_string_multi_empty( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +168,7 @@ async def array_string_multi_valid( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py index 94eee5d94b8..586565c7247 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_queries_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -127,7 +132,7 @@ def array_string_multi_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,7 +181,7 @@ def array_string_multi_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -226,7 +231,7 @@ def array_string_multi_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py index 66cd9614919..ada1cd2a9da 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_auto_rest_validation_test_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ ) from .._vendor import AutoRestValidationTestMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ async def validation_of_method_parameters( :rtype: ~validation.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +173,7 @@ async def validation_of_body( :rtype: ~validation.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -235,7 +240,7 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +320,7 @@ async def post_with_constant_in_body( :rtype: ~validation.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py index b2cbd702dc7..9b8c0319501 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload from msrest import Serializer @@ -28,6 +29,10 @@ from .. import models as _models from .._vendor import AutoRestValidationTestMixinABC, _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -147,7 +152,7 @@ def validation_of_method_parameters(self, resource_group_name: str, id: int, **k :rtype: ~validation.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +267,7 @@ def validation_of_body( :rtype: ~validation.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +334,7 @@ def get_with_constant_in_path(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +414,7 @@ def post_with_constant_in_body( :rtype: ~validation.models.Product :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py index 079b693db99..f689b8b480b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_xml_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -61,6 +62,10 @@ build_put_wrapped_lists_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,7 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> _models.RootWithR :rtype: ~xmlservice.models.RootWithRefAndNoMeta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -142,7 +147,7 @@ async def put_complex_type_ref_no_meta( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,7 +194,7 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> _models.RootWit :rtype: ~xmlservice.models.RootWithRefAndMeta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +244,7 @@ async def put_complex_type_ref_with_meta( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -286,7 +291,7 @@ async def get_simple(self, **kwargs: Any) -> _models.Slideshow: :rtype: ~xmlservice.models.Slideshow :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +342,7 @@ async def put_simple( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +390,7 @@ async def get_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: :rtype: ~xmlservice.models.AppleBarrel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +440,7 @@ async def put_wrapped_lists( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,7 +488,7 @@ async def get_headers(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,7 +533,7 @@ async def get_empty_list(self, **kwargs: Any) -> _models.Slideshow: :rtype: ~xmlservice.models.Slideshow :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,7 +583,7 @@ async def put_empty_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -625,7 +630,7 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: :rtype: ~xmlservice.models.AppleBarrel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -675,7 +680,7 @@ async def put_empty_wrapped_lists( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +727,7 @@ async def get_root_list(self, **kwargs: Any) -> List[_models.Banana]: :rtype: list[~xmlservice.models.Banana] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -772,7 +777,7 @@ async def put_root_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -820,7 +825,7 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List[_models.Banana] :rtype: list[~xmlservice.models.Banana] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -870,7 +875,7 @@ async def put_root_list_single_item( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -918,7 +923,7 @@ async def get_empty_root_list(self, **kwargs: Any) -> List[_models.Banana]: :rtype: list[~xmlservice.models.Banana] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -968,7 +973,7 @@ async def put_empty_root_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1016,7 +1021,7 @@ async def get_empty_child_element(self, **kwargs: Any) -> _models.Banana: :rtype: ~xmlservice.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1066,7 +1071,7 @@ async def put_empty_child_element( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1113,7 +1118,7 @@ async def list_containers(self, **kwargs: Any) -> _models.ListContainersResponse :rtype: ~xmlservice.models.ListContainersResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1161,7 +1166,7 @@ async def get_service_properties(self, **kwargs: Any) -> _models.StorageServiceP :rtype: ~xmlservice.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1215,7 +1220,7 @@ async def put_service_properties( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1266,7 +1271,7 @@ async def get_acls(self, **kwargs: Any) -> List[_models.SignedIdentifier]: :rtype: list[~xmlservice.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1320,7 +1325,7 @@ async def put_acls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1374,7 +1379,7 @@ async def list_blobs(self, **kwargs: Any) -> _models.ListBlobsResponse: :rtype: ~xmlservice.models.ListBlobsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1429,7 +1434,7 @@ async def json_input( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1477,7 +1482,7 @@ async def json_output(self, **kwargs: Any) -> _models.JSONOutput: :rtype: ~xmlservice.models.JSONOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1524,7 +1529,7 @@ async def get_xms_text(self, **kwargs: Any) -> _models.ObjectWithXMsTextProperty :rtype: ~xmlservice.models.ObjectWithXMsTextProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1570,7 +1575,7 @@ async def get_bytes(self, **kwargs: Any) -> _models.ModelWithByteProperty: :rtype: ~xmlservice.models.ModelWithByteProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1621,7 +1626,7 @@ async def put_binary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1670,7 +1675,7 @@ async def get_uri(self, **kwargs: Any) -> _models.ModelWithUrlProperty: :rtype: ~xmlservice.models.ModelWithUrlProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1721,7 +1726,7 @@ async def put_uri( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py index b3e7af31b42..ef8109a990b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -585,7 +590,7 @@ def get_complex_type_ref_no_meta(self, **kwargs: Any) -> _models.RootWithRefAndN :rtype: ~xmlservice.models.RootWithRefAndNoMeta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -635,7 +640,7 @@ def put_complex_type_ref_no_meta( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -682,7 +687,7 @@ def get_complex_type_ref_with_meta(self, **kwargs: Any) -> _models.RootWithRefAn :rtype: ~xmlservice.models.RootWithRefAndMeta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -732,7 +737,7 @@ def put_complex_type_ref_with_meta( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -779,7 +784,7 @@ def get_simple(self, **kwargs: Any) -> _models.Slideshow: :rtype: ~xmlservice.models.Slideshow :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -830,7 +835,7 @@ def put_simple( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -878,7 +883,7 @@ def get_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: :rtype: ~xmlservice.models.AppleBarrel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -928,7 +933,7 @@ def put_wrapped_lists( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -976,7 +981,7 @@ def get_headers(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1021,7 +1026,7 @@ def get_empty_list(self, **kwargs: Any) -> _models.Slideshow: :rtype: ~xmlservice.models.Slideshow :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1071,7 +1076,7 @@ def put_empty_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1118,7 +1123,7 @@ def get_empty_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: :rtype: ~xmlservice.models.AppleBarrel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1168,7 +1173,7 @@ def put_empty_wrapped_lists( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1215,7 +1220,7 @@ def get_root_list(self, **kwargs: Any) -> List[_models.Banana]: :rtype: list[~xmlservice.models.Banana] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1265,7 +1270,7 @@ def put_root_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1313,7 +1318,7 @@ def get_root_list_single_item(self, **kwargs: Any) -> List[_models.Banana]: :rtype: list[~xmlservice.models.Banana] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1363,7 +1368,7 @@ def put_root_list_single_item( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1411,7 +1416,7 @@ def get_empty_root_list(self, **kwargs: Any) -> List[_models.Banana]: :rtype: list[~xmlservice.models.Banana] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1461,7 +1466,7 @@ def put_empty_root_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1509,7 +1514,7 @@ def get_empty_child_element(self, **kwargs: Any) -> _models.Banana: :rtype: ~xmlservice.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1559,7 +1564,7 @@ def put_empty_child_element( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1606,7 +1611,7 @@ def list_containers(self, **kwargs: Any) -> _models.ListContainersResponse: :rtype: ~xmlservice.models.ListContainersResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1654,7 +1659,7 @@ def get_service_properties(self, **kwargs: Any) -> _models.StorageServicePropert :rtype: ~xmlservice.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1708,7 +1713,7 @@ def put_service_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1759,7 +1764,7 @@ def get_acls(self, **kwargs: Any) -> List[_models.SignedIdentifier]: :rtype: list[~xmlservice.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1813,7 +1818,7 @@ def put_acls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1867,7 +1872,7 @@ def list_blobs(self, **kwargs: Any) -> _models.ListBlobsResponse: :rtype: ~xmlservice.models.ListBlobsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1922,7 +1927,7 @@ def json_input( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1970,7 +1975,7 @@ def json_output(self, **kwargs: Any) -> _models.JSONOutput: :rtype: ~xmlservice.models.JSONOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2017,7 +2022,7 @@ def get_xms_text(self, **kwargs: Any) -> _models.ObjectWithXMsTextProperty: :rtype: ~xmlservice.models.ObjectWithXMsTextProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2063,7 +2068,7 @@ def get_bytes(self, **kwargs: Any) -> _models.ModelWithByteProperty: :rtype: ~xmlservice.models.ModelWithByteProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2114,7 +2119,7 @@ def put_binary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2163,7 +2168,7 @@ def get_uri(self, **kwargs: Any) -> _models.ModelWithUrlProperty: :rtype: ~xmlservice.models.ModelWithUrlProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2214,7 +2219,7 @@ def put_uri( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py index 2b373da8883..9e579d9a259 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_pet_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_has_models_param_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,13 +67,16 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pe :rtype: ~xmserrorresponse.models.Pet or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, 400: HttpResponseError, - 404: lambda response: ResourceNotFoundError( - response=response, model=self._deserialize(_models.NotFoundErrorBase, response) + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError( + response=response, model=self._deserialize(_models.NotFoundErrorBase, response) + ), ), 501: HttpResponseError, } @@ -117,13 +125,16 @@ async def do_something(self, what_action: str, **kwargs: Any) -> _models.PetActi :rtype: ~xmserrorresponse.models.PetAction :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 500: lambda response: HttpResponseError( - response=response, model=self._deserialize(_models.PetActionError, response) + 500: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=self._deserialize(_models.PetActionError, response) + ), ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -174,13 +185,16 @@ async def has_models_param( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 500: lambda response: HttpResponseError( - response=response, model=self._deserialize(_models.PetActionError, response) + 500: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=self._deserialize(_models.PetActionError, response) + ), ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py index 14fb5eed434..7c1fdb8fa49 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_pet_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -119,13 +124,16 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pet]: :rtype: ~xmserrorresponse.models.Pet or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, 400: HttpResponseError, - 404: lambda response: ResourceNotFoundError( - response=response, model=self._deserialize(_models.NotFoundErrorBase, response) + 404: cast( + Type[HttpResponseError], + lambda response: ResourceNotFoundError( + response=response, model=self._deserialize(_models.NotFoundErrorBase, response) + ), ), 501: HttpResponseError, } @@ -174,13 +182,16 @@ def do_something(self, what_action: str, **kwargs: Any) -> _models.PetAction: :rtype: ~xmserrorresponse.models.PetAction :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 500: lambda response: HttpResponseError( - response=response, model=self._deserialize(_models.PetActionError, response) + 500: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=self._deserialize(_models.PetActionError, response) + ), ), } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -231,13 +242,16 @@ def has_models_param( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, - 500: lambda response: HttpResponseError( - response=response, model=self._deserialize(_models.PetActionError, response) + 500: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=self._deserialize(_models.PetActionError, response) + ), ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py index dc70c6c0ba0..94f750f899f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -144,7 +144,7 @@ async def create_ap_true(self, create_parameters: Union[JSON, IO[bytes]], **kwar "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +289,7 @@ async def create_cat_ap_true(self, create_parameters: Union[JSON, IO[bytes]], ** "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,7 +429,7 @@ async def create_ap_object(self, create_parameters: Union[JSON, IO[bytes]], **kw "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,7 +569,7 @@ async def create_ap_string(self, create_parameters: Union[JSON, IO[bytes]], **kw "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,7 +709,7 @@ async def create_ap_in_properties(self, create_parameters: Union[JSON, IO[bytes] "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +871,7 @@ async def create_ap_in_properties_with_ap_string( "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py index 35475e12e12..e2f4474a810 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -242,7 +242,7 @@ def create_ap_true(self, create_parameters: Union[JSON, IO[bytes]], **kwargs: An "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -387,7 +387,7 @@ def create_cat_ap_true(self, create_parameters: Union[JSON, IO[bytes]], **kwargs "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -527,7 +527,7 @@ def create_ap_object(self, create_parameters: Union[JSON, IO[bytes]], **kwargs: "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +667,7 @@ def create_ap_string(self, create_parameters: Union[JSON, IO[bytes]], **kwargs: "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +807,7 @@ def create_ap_in_properties(self, create_parameters: Union[JSON, IO[bytes]], **k "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -967,7 +967,7 @@ def create_ap_in_properties_with_ap_string(self, create_parameters: Union[JSON, "status": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py index 20781573ea3..500a58d58f9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import AnythingClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -125,7 +130,7 @@ def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +183,7 @@ def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -226,7 +231,7 @@ def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -279,7 +284,7 @@ def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,7 +332,7 @@ def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -380,7 +385,7 @@ def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py index fb311be4cf3..04b83dc94f7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ ) from .._vendor import AnythingClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ async def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +103,7 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +151,7 @@ async def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +204,7 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -247,7 +252,7 @@ async def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +305,7 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py index 58b30cc3575..6d3bcb94f96 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_operations.py @@ -9,7 +9,7 @@ import datetime from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -138,7 +138,7 @@ async def get_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -196,7 +196,7 @@ async def get_invalid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +254,7 @@ async def get_empty(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +348,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +411,7 @@ async def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +505,7 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -568,7 +568,7 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -626,7 +626,7 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,7 +684,7 @@ async def get_integer_valid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +778,7 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -841,7 +841,7 @@ async def get_int_invalid_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -899,7 +899,7 @@ async def get_int_invalid_string(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -957,7 +957,7 @@ async def get_long_valid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1051,7 +1051,7 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1114,7 +1114,7 @@ async def get_long_invalid_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1172,7 @@ async def get_long_invalid_string(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1230,7 +1230,7 @@ async def get_float_valid(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1324,7 +1324,7 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1387,7 +1387,7 @@ async def get_float_invalid_null(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1445,7 +1445,7 @@ async def get_float_invalid_string(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1503,7 +1503,7 @@ async def get_double_valid(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1597,7 +1597,7 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1660,7 +1660,7 @@ async def get_double_invalid_null(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1718,7 +1718,7 @@ async def get_double_invalid_string(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1776,7 +1776,7 @@ async def get_string_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1870,7 +1870,7 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1933,7 +1933,7 @@ async def get_enum_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2027,7 +2027,7 @@ async def put_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2090,7 +2090,7 @@ async def get_string_enum_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2184,7 +2184,7 @@ async def put_string_enum_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2247,7 +2247,7 @@ async def get_string_with_null(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2305,7 +2305,7 @@ async def get_string_with_invalid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2364,7 +2364,7 @@ async def get_uuid_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2461,7 +2461,7 @@ async def put_uuid_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2524,7 +2524,7 @@ async def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2582,7 +2582,7 @@ async def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2676,7 +2676,7 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2739,7 +2739,7 @@ async def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2797,7 +2797,7 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2856,7 +2856,7 @@ async def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2953,7 +2953,7 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3016,7 +3016,7 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datet "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3074,7 +3074,7 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.date "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3133,7 +3133,7 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.date "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3230,7 +3230,7 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3293,7 +3293,7 @@ async def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: "1 day, 0:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3387,7 +3387,7 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3451,7 +3451,7 @@ async def get_byte_valid(self, **kwargs: Any) -> List[bytes]: bytes("bytes", encoding="utf-8") # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3548,7 +3548,7 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3611,7 +3611,7 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: bytes("bytes", encoding="utf-8") # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3670,7 +3670,7 @@ async def get_base64_url(self, **kwargs: Any) -> List[bytes]: bytes("bytes", encoding="utf-8") # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3731,7 +3731,7 @@ async def get_complex_null(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3792,7 +3792,7 @@ async def get_complex_empty(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3854,7 +3854,7 @@ async def get_complex_item_null(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3916,7 +3916,7 @@ async def get_complex_item_empty(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3978,7 +3978,7 @@ async def get_complex_valid(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4078,7 +4078,7 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4143,7 +4143,7 @@ async def get_array_null(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4203,7 +4203,7 @@ async def get_array_empty(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4263,7 +4263,7 @@ async def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4323,7 +4323,7 @@ async def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4383,7 +4383,7 @@ async def get_array_valid(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4479,7 +4479,7 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4544,7 +4544,7 @@ async def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4604,7 +4604,7 @@ async def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4665,7 +4665,7 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4726,7 +4726,7 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]] } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4787,7 +4787,7 @@ async def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4886,7 +4886,7 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py index 9bba71acd10..ee00384872e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_operations.py @@ -9,7 +9,7 @@ import datetime from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -1091,7 +1091,7 @@ def get_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1149,7 +1149,7 @@ def get_invalid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1207,7 +1207,7 @@ def get_empty(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1301,7 +1301,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1364,7 +1364,7 @@ def get_boolean_tfft(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1458,7 +1458,7 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1521,7 +1521,7 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1579,7 +1579,7 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1637,7 +1637,7 @@ def get_integer_valid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1731,7 +1731,7 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1794,7 +1794,7 @@ def get_int_invalid_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1852,7 +1852,7 @@ def get_int_invalid_string(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1910,7 +1910,7 @@ def get_long_valid(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2004,7 +2004,7 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2067,7 +2067,7 @@ def get_long_invalid_null(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2125,7 +2125,7 @@ def get_long_invalid_string(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2183,7 +2183,7 @@ def get_float_valid(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2277,7 +2277,7 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2340,7 +2340,7 @@ def get_float_invalid_null(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2398,7 +2398,7 @@ def get_float_invalid_string(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2456,7 +2456,7 @@ def get_double_valid(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2550,7 +2550,7 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2613,7 +2613,7 @@ def get_double_invalid_null(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2671,7 +2671,7 @@ def get_double_invalid_string(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2729,7 +2729,7 @@ def get_string_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2823,7 +2823,7 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2886,7 +2886,7 @@ def get_enum_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2980,7 +2980,7 @@ def put_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3043,7 +3043,7 @@ def get_string_enum_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3137,7 +3137,7 @@ def put_string_enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3200,7 +3200,7 @@ def get_string_with_null(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3258,7 +3258,7 @@ def get_string_with_invalid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3317,7 +3317,7 @@ def get_uuid_valid(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3414,7 +3414,7 @@ def put_uuid_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3477,7 +3477,7 @@ def get_uuid_invalid_chars(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3535,7 +3535,7 @@ def get_date_valid(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3629,7 +3629,7 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3692,7 +3692,7 @@ def get_date_invalid_null(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3750,7 +3750,7 @@ def get_date_invalid_chars(self, **kwargs: Any) -> List[datetime.date]: "2020-02-20" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3809,7 +3809,7 @@ def get_date_time_valid(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3906,7 +3906,7 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3969,7 +3969,7 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4027,7 +4027,7 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4086,7 +4086,7 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4183,7 +4183,7 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4246,7 +4246,7 @@ def get_duration_valid(self, **kwargs: Any) -> List[datetime.timedelta]: "1 day, 0:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4340,7 +4340,7 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4404,7 +4404,7 @@ def get_byte_valid(self, **kwargs: Any) -> List[bytes]: bytes("bytes", encoding="utf-8") # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4501,7 +4501,7 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4564,7 +4564,7 @@ def get_byte_invalid_null(self, **kwargs: Any) -> List[bytes]: bytes("bytes", encoding="utf-8") # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4623,7 +4623,7 @@ def get_base64_url(self, **kwargs: Any) -> List[bytes]: bytes("bytes", encoding="utf-8") # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4684,7 +4684,7 @@ def get_complex_null(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4745,7 +4745,7 @@ def get_complex_empty(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4807,7 +4807,7 @@ def get_complex_item_null(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4869,7 +4869,7 @@ def get_complex_item_empty(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4931,7 +4931,7 @@ def get_complex_valid(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5031,7 +5031,7 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5096,7 +5096,7 @@ def get_array_null(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5156,7 +5156,7 @@ def get_array_empty(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5216,7 +5216,7 @@ def get_array_item_null(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5276,7 +5276,7 @@ def get_array_item_empty(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5336,7 +5336,7 @@ def get_array_valid(self, **kwargs: Any) -> List[List[str]]: ] ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5432,7 +5432,7 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5497,7 +5497,7 @@ def get_dictionary_null(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5557,7 +5557,7 @@ def get_dictionary_empty(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5618,7 +5618,7 @@ def get_dictionary_item_null(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5679,7 +5679,7 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5740,7 +5740,7 @@ def get_dictionary_valid(self, **kwargs: Any) -> List[Dict[str, str]]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5839,7 +5839,7 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py index 7c8641d5208..53f4534d42c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, cast +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ build_upload_file_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def file( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ async def binary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +183,7 @@ async def error_stream(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py index 7925d29997f..0030d36849a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, IO, Iterator, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +104,7 @@ def file(self, file_param: IO[bytes], **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +154,7 @@ def binary(self, file_param: IO[bytes], **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +220,7 @@ def error_stream(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py index a9523862d2f..9fba3a923d5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_bool_put_true_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def get_true(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def put_true(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ async def get_false(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +213,7 @@ async def put_false(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +262,7 @@ async def get_null(self, **kwargs: Any) -> Optional[bool]: :rtype: bool or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,7 +312,7 @@ async def get_invalid(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py index fa37b468475..f92d6abc705 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -147,7 +152,7 @@ def get_true(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +202,7 @@ def put_true(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +251,7 @@ def get_false(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -296,7 +301,7 @@ def put_false(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -345,7 +350,7 @@ def get_null(self, **kwargs: Any) -> Optional[bool]: :rtype: bool or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -395,7 +400,7 @@ def get_invalid(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py index 060e2522003..b21c752eb2c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_byte_put_non_ascii_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def get_null(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +113,7 @@ async def get_empty(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ async def get_non_ascii(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +218,7 @@ async def put_non_ascii( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -261,7 +266,7 @@ async def get_invalid(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py index 931fc4a96e2..48403d8627e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -128,7 +133,7 @@ def get_null(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +183,7 @@ def get_empty(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -228,7 +233,7 @@ def get_non_ascii(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +286,7 @@ def put_non_ascii(self, byte_body: bytes, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +334,7 @@ def get_invalid(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py index fa9d347d5b3..72a414e8816 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -128,7 +128,7 @@ async def get_valid(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,7 +241,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +310,7 @@ async def get_invalid(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +373,7 @@ async def get_empty(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,7 +436,7 @@ async def get_null(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -499,7 +499,7 @@ async def get_not_provided(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -576,7 +576,7 @@ async def get_int(self, **kwargs: Any) -> JSON: "field2": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -680,7 +680,7 @@ async def put_int( # pylint: disable=inconsistent-return-statements "field2": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -744,7 +744,7 @@ async def get_long(self, **kwargs: Any) -> JSON: "field2": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -849,7 +849,7 @@ async def put_long( # pylint: disable=inconsistent-return-statements "field2": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -913,7 +913,7 @@ async def get_float(self, **kwargs: Any) -> JSON: "field2": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1018,7 +1018,7 @@ async def put_float( # pylint: disable=inconsistent-return-statements "field2": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1084,7 +1084,7 @@ async def get_double(self, **kwargs: Any) -> JSON: 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1196,7 +1196,7 @@ async def put_double( # pylint: disable=inconsistent-return-statements 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1260,7 +1260,7 @@ async def get_bool(self, **kwargs: Any) -> JSON: "field_true": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1365,7 +1365,7 @@ async def put_bool( # pylint: disable=inconsistent-return-statements "field_true": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1430,7 +1430,7 @@ async def get_string(self, **kwargs: Any) -> JSON: "null": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1537,7 +1537,7 @@ async def put_string( # pylint: disable=inconsistent-return-statements "null": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1601,7 +1601,7 @@ async def get_date(self, **kwargs: Any) -> JSON: "leap": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1706,7 @@ async def put_date( # pylint: disable=inconsistent-return-statements "leap": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1770,7 +1770,7 @@ async def get_date_time(self, **kwargs: Any) -> JSON: "now": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1877,7 +1877,7 @@ async def put_date_time( # pylint: disable=inconsistent-return-statements "now": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1941,7 +1941,7 @@ async def get_date_time_rfc1123(self, **kwargs: Any) -> JSON: "now": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2048,7 +2048,7 @@ async def put_date_time_rfc1123( # pylint: disable=inconsistent-return-statemen "now": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2111,7 +2111,7 @@ async def get_duration(self, **kwargs: Any) -> JSON: "field": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2214,7 +2214,7 @@ async def put_duration( # pylint: disable=inconsistent-return-statements "field": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2277,7 +2277,7 @@ async def get_byte(self, **kwargs: Any) -> JSON: "field": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2382,7 +2382,7 @@ async def put_byte( # pylint: disable=inconsistent-return-statements "field": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2465,7 +2465,7 @@ async def get_valid(self, **kwargs: Any) -> JSON: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2574,7 +2574,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2639,7 +2639,7 @@ async def get_empty(self, **kwargs: Any) -> JSON: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2746,7 +2746,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2811,7 +2811,7 @@ async def get_not_provided(self, **kwargs: Any) -> JSON: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2889,7 +2889,7 @@ async def get_valid(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2999,7 +2999,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3064,7 +3064,7 @@ async def get_empty(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3171,7 +3171,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3236,7 +3236,7 @@ async def get_null(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3296,7 +3296,7 @@ async def get_not_provided(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3382,7 +3382,7 @@ async def get_valid(self, **kwargs: Any) -> JSON: "name": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3511,7 +3511,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements "name": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3647,7 +3647,7 @@ async def get_valid(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3955,7 +3955,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. complex_body = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4027,7 +4027,7 @@ async def get_dot_syntax(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == dot_fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4115,7 +4115,7 @@ async def get_composed_with_discriminator(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4203,7 +4203,7 @@ async def get_composed_without_discriminator(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4276,7 +4276,7 @@ async def get_complicated(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == salmon """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4409,7 +4409,7 @@ async def put_complicated( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. complex_body = salmon """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4602,7 +4602,7 @@ async def put_missing_discriminator(self, complex_body: Union[JSON, IO[bytes]], # response body for status code(s): 200 response == salmon """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4907,7 +4907,7 @@ async def put_valid_missing_required( # pylint: disable=inconsistent-return-sta # JSON input template you can fill out and use as your body input. complex_body = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5043,7 +5043,7 @@ async def get_valid(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5411,7 +5411,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. complex_body = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5493,7 +5493,7 @@ async def get_valid(self, **kwargs: Any) -> JSON: "size": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5597,7 +5597,7 @@ async def put_valid( # pylint: disable=inconsistent-return-statements "size": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5689,7 +5689,7 @@ async def get_valid(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == my_base_type """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py index 08ca29ef07b..e5af732518e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -925,7 +925,7 @@ def get_valid(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1038,7 +1038,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1107,7 +1107,7 @@ def get_invalid(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1170,7 +1170,7 @@ def get_empty(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1233,7 +1233,7 @@ def get_null(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1296,7 +1296,7 @@ def get_not_provided(self, **kwargs: Any) -> JSON: does not fit on a single line and a line break. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1373,7 +1373,7 @@ def get_int(self, **kwargs: Any) -> JSON: "field2": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1477,7 +1477,7 @@ def put_int( # pylint: disable=inconsistent-return-statements "field2": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1541,7 +1541,7 @@ def get_long(self, **kwargs: Any) -> JSON: "field2": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1646,7 +1646,7 @@ def put_long( # pylint: disable=inconsistent-return-statements "field2": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1710,7 +1710,7 @@ def get_float(self, **kwargs: Any) -> JSON: "field2": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1815,7 +1815,7 @@ def put_float( # pylint: disable=inconsistent-return-statements "field2": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1881,7 +1881,7 @@ def get_double(self, **kwargs: Any) -> JSON: 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1993,7 +1993,7 @@ def put_double( # pylint: disable=inconsistent-return-statements 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2057,7 +2057,7 @@ def get_bool(self, **kwargs: Any) -> JSON: "field_true": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2162,7 +2162,7 @@ def put_bool( # pylint: disable=inconsistent-return-statements "field_true": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2227,7 +2227,7 @@ def get_string(self, **kwargs: Any) -> JSON: "null": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2334,7 +2334,7 @@ def put_string( # pylint: disable=inconsistent-return-statements "null": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2398,7 +2398,7 @@ def get_date(self, **kwargs: Any) -> JSON: "leap": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2503,7 +2503,7 @@ def put_date( # pylint: disable=inconsistent-return-statements "leap": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2567,7 +2567,7 @@ def get_date_time(self, **kwargs: Any) -> JSON: "now": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2674,7 +2674,7 @@ def put_date_time( # pylint: disable=inconsistent-return-statements "now": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2738,7 +2738,7 @@ def get_date_time_rfc1123(self, **kwargs: Any) -> JSON: "now": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2845,7 +2845,7 @@ def put_date_time_rfc1123( # pylint: disable=inconsistent-return-statements "now": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2908,7 +2908,7 @@ def get_duration(self, **kwargs: Any) -> JSON: "field": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3011,7 +3011,7 @@ def put_duration( # pylint: disable=inconsistent-return-statements "field": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3074,7 +3074,7 @@ def get_byte(self, **kwargs: Any) -> JSON: "field": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3179,7 +3179,7 @@ def put_byte( # pylint: disable=inconsistent-return-statements "field": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3262,7 +3262,7 @@ def get_valid(self, **kwargs: Any) -> JSON: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3371,7 +3371,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3436,7 +3436,7 @@ def get_empty(self, **kwargs: Any) -> JSON: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3543,7 +3543,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3608,7 +3608,7 @@ def get_not_provided(self, **kwargs: Any) -> JSON: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3686,7 +3686,7 @@ def get_valid(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3796,7 +3796,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3861,7 +3861,7 @@ def get_empty(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3968,7 +3968,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4033,7 +4033,7 @@ def get_null(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4093,7 +4093,7 @@ def get_not_provided(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4179,7 +4179,7 @@ def get_valid(self, **kwargs: Any) -> JSON: "name": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4308,7 +4308,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements "name": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4444,7 +4444,7 @@ def get_valid(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4752,7 +4752,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. complex_body = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4824,7 +4824,7 @@ def get_dot_syntax(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == dot_fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4912,7 +4912,7 @@ def get_composed_with_discriminator(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5000,7 +5000,7 @@ def get_composed_without_discriminator(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5073,7 +5073,7 @@ def get_complicated(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == salmon """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5206,7 +5206,7 @@ def put_complicated( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. complex_body = salmon """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5399,7 +5399,7 @@ def put_missing_discriminator(self, complex_body: Union[JSON, IO[bytes]], **kwar # response body for status code(s): 200 response == salmon """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5704,7 +5704,7 @@ def put_valid_missing_required( # pylint: disable=inconsistent-return-statement # JSON input template you can fill out and use as your body input. complex_body = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5840,7 +5840,7 @@ def get_valid(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6208,7 +6208,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. complex_body = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6290,7 +6290,7 @@ def get_valid(self, **kwargs: Any) -> JSON: "size": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6394,7 +6394,7 @@ def put_valid( # pylint: disable=inconsistent-return-statements "size": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6486,7 +6486,7 @@ def get_valid(self, **kwargs: Any) -> JSON: # response body for status code(s): 200 response == my_base_type """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py index 90f324e8560..022f2664ada 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +35,10 @@ build_datetimerfc1123_put_utc_min_date_time_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +118,7 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +168,7 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +218,7 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +272,7 @@ async def put_utc_max_date_time( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +320,7 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -365,7 +370,7 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +424,7 @@ async def put_utc_min_date_time( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,7 +472,7 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py index 40c9cbaeac0..bdd7477418b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -196,7 +201,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +251,7 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -296,7 +301,7 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +351,7 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,7 +405,7 @@ def put_utc_max_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +453,7 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -498,7 +503,7 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -552,7 +557,7 @@ def put_utc_min_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -600,7 +605,7 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py index f42347666aa..a40998c25c6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -47,6 +48,10 @@ build_datetime_put_utc_min_date_time_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +131,7 @@ async def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,7 +181,7 @@ async def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -226,7 +231,7 @@ async def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,7 +285,7 @@ async def put_utc_max_date_time( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,7 +340,7 @@ async def put_utc_max_date_time7_digits( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +388,7 @@ async def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +438,7 @@ async def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datet :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,7 +491,7 @@ async def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -540,7 +545,7 @@ async def put_local_positive_offset_max_date_time( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +595,7 @@ async def get_local_positive_offset_lowercase_max_date_time( # pylint: disable= :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -642,7 +647,7 @@ async def get_local_positive_offset_uppercase_max_date_time( # pylint: disable= :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +701,7 @@ async def put_local_negative_offset_max_date_time( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -746,7 +751,7 @@ async def get_local_negative_offset_uppercase_max_date_time( # pylint: disable= :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -798,7 +803,7 @@ async def get_local_negative_offset_lowercase_max_date_time( # pylint: disable= :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -852,7 +857,7 @@ async def put_utc_min_date_time( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -900,7 +905,7 @@ async def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -954,7 +959,7 @@ async def put_local_positive_offset_min_date_time( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1002,7 +1007,7 @@ async def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1056,7 +1061,7 @@ async def put_local_negative_offset_min_date_time( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1104,7 +1109,7 @@ async def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> dateti :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1154,7 +1159,7 @@ async def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py index 74c08ee591d..0137a9edd50 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -419,7 +424,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +474,7 @@ def get_invalid(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,7 +524,7 @@ def get_overflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,7 +574,7 @@ def get_underflow(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -623,7 +628,7 @@ def put_utc_max_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -678,7 +683,7 @@ def put_utc_max_date_time7_digits( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -726,7 +731,7 @@ def get_utc_lowercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -776,7 +781,7 @@ def get_utc_uppercase_max_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -829,7 +834,7 @@ def get_utc_uppercase_max_date_time7_digits(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -883,7 +888,7 @@ def put_local_positive_offset_max_date_time( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -933,7 +938,7 @@ def get_local_positive_offset_lowercase_max_date_time( # pylint: disable=name-t :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -985,7 +990,7 @@ def get_local_positive_offset_uppercase_max_date_time( # pylint: disable=name-t :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1039,7 +1044,7 @@ def put_local_negative_offset_max_date_time( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1094,7 @@ def get_local_negative_offset_uppercase_max_date_time( # pylint: disable=name-t :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1141,7 +1146,7 @@ def get_local_negative_offset_lowercase_max_date_time( # pylint: disable=name-t :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1195,7 +1200,7 @@ def put_utc_min_date_time( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1243,7 +1248,7 @@ def get_utc_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1297,7 +1302,7 @@ def put_local_positive_offset_min_date_time( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1345,7 +1350,7 @@ def get_local_positive_offset_min_date_time(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1399,7 +1404,7 @@ def put_local_negative_offset_min_date_time( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1447,7 +1452,7 @@ def get_local_negative_offset_min_date_time(self, **kwargs: Any) -> datetime.dat :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1497,7 +1502,7 @@ def get_local_no_offset_min_date_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py index ea41bb7161a..ec1e41a56bb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ build_date_put_min_date_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +67,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.date]: :rtype: ~datetime.date or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ async def get_invalid_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ async def get_overflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,7 +217,7 @@ async def get_underflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,7 +271,7 @@ async def put_max_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +319,7 @@ async def get_max_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +373,7 @@ async def put_min_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -416,7 +421,7 @@ async def get_min_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py index 96031d53071..7f429566cb9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -174,7 +179,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.date]: :rtype: ~datetime.date or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +229,7 @@ def get_invalid_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +279,7 @@ def get_overflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +329,7 @@ def get_underflow_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +383,7 @@ def put_max_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -426,7 +431,7 @@ def get_max_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +485,7 @@ def put_min_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,7 +533,7 @@ def get_min_date(self, **kwargs: Any) -> datetime.date: :rtype: ~datetime.date :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py index f2bcd8f8697..6ebd96dc078 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_operations.py @@ -9,7 +9,7 @@ import datetime from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -134,7 +134,7 @@ async def get_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +192,7 @@ async def get_empty(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -286,7 +286,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -349,7 +349,7 @@ async def get_null_value(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +407,7 @@ async def get_null_key(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -465,7 +465,7 @@ async def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -523,7 +523,7 @@ async def get_invalid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +581,7 @@ async def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -675,7 +675,7 @@ async def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -738,7 +738,7 @@ async def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -796,7 +796,7 @@ async def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -854,7 +854,7 @@ async def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -948,7 +948,7 @@ async def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1011,7 +1011,7 @@ async def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1069,7 +1069,7 @@ async def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1127,7 +1127,7 @@ async def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1221,7 +1221,7 @@ async def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1284,7 +1284,7 @@ async def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1342,7 +1342,7 @@ async def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1400,7 +1400,7 @@ async def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1494,7 +1494,7 @@ async def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1557,7 +1557,7 @@ async def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1615,7 +1615,7 @@ async def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1673,7 +1673,7 @@ async def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1767,7 +1767,7 @@ async def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1830,7 +1830,7 @@ async def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1888,7 +1888,7 @@ async def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1946,7 +1946,7 @@ async def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2040,7 +2040,7 @@ async def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2103,7 +2103,7 @@ async def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2161,7 +2161,7 @@ async def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2219,7 +2219,7 @@ async def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: "str": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2313,7 +2313,7 @@ async def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2376,7 +2376,7 @@ async def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date] "str": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2434,7 +2434,7 @@ async def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date "str": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2493,7 +2493,7 @@ async def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetim "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2590,7 +2590,7 @@ async def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2653,7 +2653,7 @@ async def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime. "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2711,7 +2711,7 @@ async def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2770,7 +2770,7 @@ async def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2867,7 +2867,7 @@ async def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2930,7 +2930,7 @@ async def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelt "str": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3024,7 +3024,7 @@ async def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3088,7 +3088,7 @@ async def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytes]: "str": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3185,7 +3185,7 @@ async def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3249,7 +3249,7 @@ async def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytes]: "str": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3308,7 +3308,7 @@ async def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: "str": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3369,7 +3369,7 @@ async def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSON]]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3430,7 +3430,7 @@ async def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3492,7 +3492,7 @@ async def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3554,7 +3554,7 @@ async def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3616,7 +3616,7 @@ async def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3716,7 +3716,7 @@ async def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3781,7 +3781,7 @@ async def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3841,7 +3841,7 @@ async def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3901,7 +3901,7 @@ async def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3961,7 +3961,7 @@ async def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4022,7 +4022,7 @@ async def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4121,7 +4121,7 @@ async def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4186,7 +4186,7 @@ async def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4246,7 +4246,7 @@ async def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]] } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4307,7 +4307,7 @@ async def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, s } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4368,7 +4368,7 @@ async def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4430,7 +4430,7 @@ async def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]] } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4532,7 +4532,7 @@ async def put_dictionary_valid( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py index a7993dffbc8..a947474723a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_operations.py @@ -9,7 +9,7 @@ import datetime from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -1026,7 +1026,7 @@ def get_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1084,7 +1084,7 @@ def get_empty(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1178,7 +1178,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1241,7 +1241,7 @@ def get_null_value(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1299,7 +1299,7 @@ def get_null_key(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1357,7 +1357,7 @@ def get_empty_string_key(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1415,7 +1415,7 @@ def get_invalid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1473,7 +1473,7 @@ def get_boolean_tfft(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1567,7 +1567,7 @@ def put_boolean_tfft( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1630,7 +1630,7 @@ def get_boolean_invalid_null(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1688,7 +1688,7 @@ def get_boolean_invalid_string(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1746,7 +1746,7 @@ def get_integer_valid(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1840,7 +1840,7 @@ def put_integer_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1903,7 +1903,7 @@ def get_int_invalid_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1961,7 +1961,7 @@ def get_int_invalid_string(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2019,7 +2019,7 @@ def get_long_valid(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2113,7 +2113,7 @@ def put_long_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2176,7 +2176,7 @@ def get_long_invalid_null(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2234,7 +2234,7 @@ def get_long_invalid_string(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2292,7 +2292,7 @@ def get_float_valid(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2386,7 +2386,7 @@ def put_float_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2449,7 +2449,7 @@ def get_float_invalid_null(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2507,7 +2507,7 @@ def get_float_invalid_string(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2565,7 +2565,7 @@ def get_double_valid(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2659,7 +2659,7 @@ def put_double_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2722,7 +2722,7 @@ def get_double_invalid_null(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2780,7 +2780,7 @@ def get_double_invalid_string(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2838,7 +2838,7 @@ def get_string_valid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2932,7 +2932,7 @@ def put_string_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2995,7 +2995,7 @@ def get_string_with_null(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3053,7 +3053,7 @@ def get_string_with_invalid(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3111,7 +3111,7 @@ def get_date_valid(self, **kwargs: Any) -> Dict[str, datetime.date]: "str": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3205,7 +3205,7 @@ def put_date_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3268,7 +3268,7 @@ def get_date_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.date]: "str": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3326,7 +3326,7 @@ def get_date_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.date]: "str": "2020-02-20" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3385,7 +3385,7 @@ def get_date_time_valid(self, **kwargs: Any) -> Dict[str, datetime.datetime]: "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3482,7 +3482,7 @@ def put_date_time_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3545,7 +3545,7 @@ def get_date_time_invalid_null(self, **kwargs: Any) -> Dict[str, datetime.dateti "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3603,7 +3603,7 @@ def get_date_time_invalid_chars(self, **kwargs: Any) -> Dict[str, datetime.datet "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3662,7 +3662,7 @@ def get_date_time_rfc1123_valid(self, **kwargs: Any) -> Dict[str, datetime.datet "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3759,7 +3759,7 @@ def put_date_time_rfc1123_valid( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3822,7 +3822,7 @@ def get_duration_valid(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: "str": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3916,7 +3916,7 @@ def put_duration_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3980,7 +3980,7 @@ def get_byte_valid(self, **kwargs: Any) -> Dict[str, bytes]: "str": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4077,7 +4077,7 @@ def put_byte_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4141,7 +4141,7 @@ def get_byte_invalid_null(self, **kwargs: Any) -> Dict[str, bytes]: "str": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4200,7 +4200,7 @@ def get_base64_url(self, **kwargs: Any) -> Dict[str, bytes]: "str": bytes("bytes", encoding="utf-8") # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4261,7 +4261,7 @@ def get_complex_null(self, **kwargs: Any) -> Optional[Dict[str, JSON]]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4322,7 +4322,7 @@ def get_complex_empty(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4384,7 +4384,7 @@ def get_complex_item_null(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4446,7 +4446,7 @@ def get_complex_item_empty(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4508,7 +4508,7 @@ def get_complex_valid(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4608,7 +4608,7 @@ def put_complex_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4673,7 +4673,7 @@ def get_array_null(self, **kwargs: Any) -> Optional[Dict[str, List[str]]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4733,7 +4733,7 @@ def get_array_empty(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4793,7 +4793,7 @@ def get_array_item_null(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4853,7 +4853,7 @@ def get_array_item_empty(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4914,7 +4914,7 @@ def get_array_valid(self, **kwargs: Any) -> Dict[str, List[str]]: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5013,7 +5013,7 @@ def put_array_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5078,7 +5078,7 @@ def get_dictionary_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5138,7 +5138,7 @@ def get_dictionary_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5199,7 +5199,7 @@ def get_dictionary_item_null(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5260,7 +5260,7 @@ def get_dictionary_item_empty(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5322,7 +5322,7 @@ def get_dictionary_valid(self, **kwargs: Any) -> Dict[str, Dict[str, str]]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5424,7 +5424,7 @@ def put_dictionary_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py index f3a1522cd5a..d83541e2e02 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_duration_put_positive_duration_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,7 +117,7 @@ async def put_positive_duration( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +165,7 @@ async def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +215,7 @@ async def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py index aa142ccb3fd..50e1d1adc5d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -117,7 +122,7 @@ def get_null(self, **kwargs: Any) -> Optional[datetime.timedelta]: :rtype: ~datetime.timedelta or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +176,7 @@ def put_positive_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +224,7 @@ def get_positive_duration(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +274,7 @@ def get_invalid(self, **kwargs: Any) -> datetime.timedelta: :rtype: ~datetime.timedelta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py index 0c9dcfeb467..dcd16a8650c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterator, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ build_files_get_file_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +60,7 @@ async def get_file(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +107,7 @@ async def get_file_large(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +154,7 @@ async def get_empty_file(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py index fbdd0948cf3..562f3db9f79 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Iterator, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Iterator, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +102,7 @@ def get_file(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +149,7 @@ def get_file_large(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +196,7 @@ def get_empty_file(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py index 8f33d101ae1..ff249a03d38 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, cast +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from ...operations._operations import build_formdata_upload_file_via_body_request from .._vendor import raise_if_not_implemented +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +68,7 @@ async def upload_file_via_body(self, file_content: IO[bytes], **kwargs: Any) -> :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py index b9d3a5000e8..b6e0e95bc2d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, IO, Iterator, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import raise_if_not_implemented +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ def upload_file_via_body(self, file_content: IO[bytes], **kwargs: Any) -> Iterat :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py index 6640339470c..3f24e1aac01 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -39,6 +40,10 @@ build_int_operations_put_unix_time_date_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +73,7 @@ async def get_null(self, **kwargs: Any) -> Optional[int]: :rtype: int or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +123,7 @@ async def get_invalid(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +173,7 @@ async def get_overflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +223,7 @@ async def get_underflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +273,7 @@ async def get_overflow_int64(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,7 +323,7 @@ async def get_underflow_int64(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -370,7 +375,7 @@ async def put_max32(self, int_body: int, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +425,7 @@ async def put_max64(self, int_body: int, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +475,7 @@ async def put_min32(self, int_body: int, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -520,7 +525,7 @@ async def put_min64(self, int_body: int, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -568,7 +573,7 @@ async def get_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +627,7 @@ async def put_unix_time_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +675,7 @@ async def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +725,7 @@ async def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime] :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py index a4cc7863ba4..14d2bbab314 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -269,7 +274,7 @@ def get_null(self, **kwargs: Any) -> Optional[int]: :rtype: int or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +324,7 @@ def get_invalid(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +374,7 @@ def get_overflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +424,7 @@ def get_underflow_int32(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +474,7 @@ def get_overflow_int64(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,7 +524,7 @@ def get_underflow_int64(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +576,7 @@ def put_max32(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -621,7 +626,7 @@ def put_max64(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -671,7 +676,7 @@ def put_min32(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -721,7 +726,7 @@ def put_min64(self, int_body: int, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -769,7 +774,7 @@ def get_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -823,7 +828,7 @@ def put_unix_time_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +876,7 @@ def get_invalid_unix_time(self, **kwargs: Any) -> datetime.datetime: :rtype: ~datetime.datetime :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -921,7 +926,7 @@ def get_null_unix_time(self, **kwargs: Any) -> Optional[datetime.datetime]: :rtype: ~datetime.datetime or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py index e59fd277f18..53978940eb3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -48,6 +49,10 @@ build_number_put_small_float_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,7 @@ async def get_null(self, **kwargs: Any) -> Optional[float]: :rtype: float or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -127,7 +132,7 @@ async def get_invalid_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,7 +182,7 @@ async def get_invalid_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +232,7 @@ async def get_invalid_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +286,7 @@ async def put_big_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,7 +334,7 @@ async def get_big_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +388,7 @@ async def put_big_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +436,7 @@ async def get_big_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,7 +488,7 @@ async def put_big_double_positive_decimal( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -532,7 +537,7 @@ async def get_big_double_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -584,7 +589,7 @@ async def put_big_double_negative_decimal( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +638,7 @@ async def get_big_double_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -687,7 +692,7 @@ async def put_big_decimal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +740,7 @@ async def get_big_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +792,7 @@ async def put_big_decimal_positive_decimal( # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,7 +841,7 @@ async def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -888,7 +893,7 @@ async def put_big_decimal_negative_decimal( # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +942,7 @@ async def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -991,7 +996,7 @@ async def put_small_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1039,7 +1044,7 @@ async def get_small_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1093,7 +1098,7 @@ async def put_small_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1141,7 +1146,7 @@ async def get_small_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1195,7 +1200,7 @@ async def put_small_decimal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1243,7 +1248,7 @@ async def get_small_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py index d191562dff1..1ff8367fc79 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -433,7 +438,7 @@ def get_null(self, **kwargs: Any) -> Optional[float]: :rtype: float or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,7 +488,7 @@ def get_invalid_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -533,7 +538,7 @@ def get_invalid_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,7 +588,7 @@ def get_invalid_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -637,7 +642,7 @@ def put_big_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -685,7 +690,7 @@ def get_big_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -739,7 +744,7 @@ def put_big_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -787,7 +792,7 @@ def get_big_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -837,7 +842,7 @@ def put_big_double_positive_decimal(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -886,7 +891,7 @@ def get_big_double_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -936,7 +941,7 @@ def put_big_double_negative_decimal(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -985,7 +990,7 @@ def get_big_double_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1039,7 +1044,7 @@ def put_big_decimal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1087,7 +1092,7 @@ def get_big_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1137,7 +1142,7 @@ def put_big_decimal_positive_decimal(self, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1186,7 +1191,7 @@ def get_big_decimal_positive_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1236,7 +1241,7 @@ def put_big_decimal_negative_decimal(self, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1285,7 +1290,7 @@ def get_big_decimal_negative_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1339,7 +1344,7 @@ def put_small_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1387,7 +1392,7 @@ def get_small_float(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1441,7 +1446,7 @@ def put_small_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1489,7 +1494,7 @@ def get_small_double(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1543,7 +1548,7 @@ def put_small_decimal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1591,7 +1596,7 @@ def get_small_decimal(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py index 29cc972ec3b..6578c7dcdfa 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -79,7 +79,7 @@ async def get_null(self, **kwargs: Any) -> Optional[str]: :rtype: str or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,7 +133,7 @@ async def put_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,7 +184,7 @@ async def get_empty(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -234,7 +234,7 @@ async def put_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,7 +283,7 @@ async def get_mbcs(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +333,7 @@ async def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +386,7 @@ async def get_whitespace(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -438,7 +438,7 @@ async def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +489,7 @@ async def get_not_provided(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -539,7 +539,7 @@ async def get_base64_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +589,7 @@ async def get_base64_url_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +643,7 @@ async def put_base64_url_encoded( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -691,7 +691,7 @@ async def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: :rtype: bytes or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -759,7 +759,7 @@ async def get_not_expandable(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -814,7 +814,7 @@ async def put_not_expandable( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -862,7 +862,7 @@ async def get_referenced(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -917,7 +917,7 @@ async def put_referenced( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -975,7 +975,7 @@ async def get_referenced_constant(self, **kwargs: Any) -> JSON: "field1": "str" # Optional. Sample string. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1081,7 +1081,7 @@ async def put_referenced_constant( # pylint: disable=inconsistent-return-statem "field1": "str" # Optional. Sample string. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py index 5b7adf7d873..f049a91b427 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -361,7 +361,7 @@ def get_null(self, **kwargs: Any) -> Optional[str]: :rtype: str or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +415,7 @@ def put_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -466,7 +466,7 @@ def get_empty(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -516,7 +516,7 @@ def put_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -565,7 +565,7 @@ def get_mbcs(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -615,7 +615,7 @@ def put_mbcs(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -668,7 +668,7 @@ def get_whitespace(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -720,7 +720,7 @@ def put_whitespace(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -771,7 +771,7 @@ def get_not_provided(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -821,7 +821,7 @@ def get_base64_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +871,7 @@ def get_base64_url_encoded(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -925,7 +925,7 @@ def put_base64_url_encoded( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -973,7 +973,7 @@ def get_null_base64_url_encoded(self, **kwargs: Any) -> Optional[bytes]: :rtype: bytes or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1041,7 +1041,7 @@ def get_not_expandable(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1096,7 +1096,7 @@ def put_not_expandable( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1144,7 +1144,7 @@ def get_referenced(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1199,7 +1199,7 @@ def put_referenced( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1257,7 +1257,7 @@ def get_referenced_constant(self, **kwargs: Any) -> JSON: "field1": "str" # Optional. Sample string. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1363,7 +1363,7 @@ def put_referenced_constant( # pylint: disable=inconsistent-return-statements "field1": "str" # Optional. Sample string. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py index f72575d45c5..5e4b3a41aca 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from ...operations._operations import build_time_get_request, build_time_put_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ async def get(self, **kwargs: Any) -> datetime.time: :rtype: ~datetime.time :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +110,7 @@ async def put(self, time_body: datetime.time, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py index ecd068702c8..5f19c1354af 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +92,7 @@ def get(self, **kwargs: Any) -> datetime.time: :rtype: ~datetime.time :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +144,7 @@ def put(self, time_body: datetime.time, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_operations.py index f8033ec809d..6aabecbb014 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import ClientWithEnumMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_operations.py index a6dcef58294..f0bee746bfb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_client_with_enum_head_request from .._vendor import ClientWithEnumMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +41,7 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py index 05362c70937..d9beb77e64a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -41,6 +42,10 @@ build_contants_put_no_model_as_string_required_two_value_no_default_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,7 @@ async def put_no_model_as_string_no_required_two_value_no_default( # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +131,7 @@ async def put_no_model_as_string_no_required_two_value_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -176,7 +181,7 @@ async def put_no_model_as_string_no_required_one_value_no_default( # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -226,7 +231,7 @@ async def put_no_model_as_string_no_required_one_value_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,7 +281,7 @@ async def put_no_model_as_string_required_two_value_no_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +331,7 @@ async def put_no_model_as_string_required_two_value_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -374,7 +379,7 @@ async def put_no_model_as_string_required_one_value_no_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +428,7 @@ async def put_no_model_as_string_required_one_value_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -474,7 +479,7 @@ async def put_model_as_string_no_required_two_value_no_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -524,7 +529,7 @@ async def put_model_as_string_no_required_two_value_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +579,7 @@ async def put_model_as_string_no_required_one_value_no_default( # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -624,7 +629,7 @@ async def put_model_as_string_no_required_one_value_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -674,7 +679,7 @@ async def put_model_as_string_required_two_value_no_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -724,7 +729,7 @@ async def put_model_as_string_required_two_value_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +779,7 @@ async def put_model_as_string_required_one_value_no_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -824,7 +829,7 @@ async def put_model_as_string_required_one_value_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +874,7 @@ async def put_client_constants(self, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py index d23c47256e4..2ec961779d2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -319,7 +324,7 @@ def put_no_model_as_string_no_required_two_value_no_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +374,7 @@ def put_no_model_as_string_no_required_two_value_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +424,7 @@ def put_no_model_as_string_no_required_one_value_no_default( # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +474,7 @@ def put_no_model_as_string_no_required_one_value_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,7 +524,7 @@ def put_no_model_as_string_required_two_value_no_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,7 +574,7 @@ def put_no_model_as_string_required_two_value_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,7 +622,7 @@ def put_no_model_as_string_required_one_value_no_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -666,7 +671,7 @@ def put_no_model_as_string_required_one_value_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -717,7 +722,7 @@ def put_model_as_string_no_required_two_value_no_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -767,7 +772,7 @@ def put_model_as_string_no_required_two_value_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -817,7 +822,7 @@ def put_model_as_string_no_required_one_value_no_default( # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -867,7 +872,7 @@ def put_model_as_string_no_required_one_value_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -917,7 +922,7 @@ def put_model_as_string_required_two_value_no_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -967,7 +972,7 @@ def put_model_as_string_required_two_value_default( # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1017,7 +1022,7 @@ def put_model_as_string_required_one_value_no_default( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1067,7 +1072,7 @@ def put_model_as_string_required_one_value_default( # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1112,7 +1117,7 @@ def put_client_constants(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py index 06098b91a78..e57268f72e4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from ...operations._operations import build_paths_get_empty_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +66,7 @@ async def get_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py index 2037e3b398c..9b8c6df6311 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,7 @@ def get_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py index 23c7fca12d0..37d9c210da9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from ...operations._operations import build_paths_get_empty_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +60,7 @@ async def get_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py index 35874fd4028..c70f52c14d4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ def get_empty(self, account_name: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_operations.py index 101d8145254..102832359db 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -85,7 +85,7 @@ def create_secret(self, **kwargs: Any) -> JSON: "value": "str" # The secret value. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +135,7 @@ def get_error_with_secrets(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_operations.py index f7f1b9dd055..697cfb7ae38 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -54,7 +54,7 @@ async def create_secret(self, **kwargs: Any) -> JSON: "value": "str" # The secret value. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -104,7 +104,7 @@ async def get_error_with_secrets(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py index c2d06c68cf2..4f732908e08 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -74,7 +74,7 @@ async def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSON: "name": "str" # Optional. name. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +216,7 @@ async def add_pet(self, pet_param: Optional[Union[JSON, IO[bytes]]] = None, **kw "name": "str" # Optional. name. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py index 375bed0284e..736a6228a72 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -113,7 +113,7 @@ def get_by_pet_id(self, pet_id: str, **kwargs: Any) -> JSON: "name": "str" # Optional. name. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,7 +255,7 @@ def add_pet(self, pet_param: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: "name": "str" # Optional. name. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py index ac75bac1214..ec195449b3c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -53,6 +54,10 @@ build_header_response_string_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +92,7 @@ async def param_existing_key( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +136,7 @@ async def response_existing_key(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,7 +182,7 @@ async def param_protected_key(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +227,7 @@ async def response_protected_key(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,7 +281,7 @@ async def param_integer( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +331,7 @@ async def response_integer( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -381,7 +386,7 @@ async def param_long( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +436,7 @@ async def response_long( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,7 +491,7 @@ async def param_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +541,7 @@ async def response_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -591,7 +596,7 @@ async def param_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +646,7 @@ async def response_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +701,7 @@ async def param_bool( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -746,7 +751,7 @@ async def response_bool( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -802,7 +807,7 @@ async def param_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -852,7 +857,7 @@ async def response_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -907,7 +912,7 @@ async def param_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -957,7 +962,7 @@ async def response_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1013,7 +1018,7 @@ async def param_datetime( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1063,7 +1068,7 @@ async def response_datetime( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1124,7 @@ async def param_datetime_rfc1123( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1170,7 +1175,7 @@ async def response_datetime_rfc1123( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1223,7 +1228,7 @@ async def param_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1272,7 +1277,7 @@ async def response_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1325,7 +1330,7 @@ async def param_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1374,7 +1379,7 @@ async def response_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1430,7 +1435,7 @@ async def param_enum( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1480,7 +1485,7 @@ async def response_enum( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1528,7 +1533,7 @@ async def custom_request_id(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py index dd5d7d06e03..597cf0f415b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -513,7 +518,7 @@ def param_existing_key( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -557,7 +562,7 @@ def response_existing_key(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -603,7 +608,7 @@ def param_protected_key(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +653,7 @@ def response_protected_key(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -702,7 +707,7 @@ def param_integer( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -752,7 +757,7 @@ def response_integer( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +812,7 @@ def param_long( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -855,7 +860,7 @@ def response_long(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -910,7 +915,7 @@ def param_float( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -958,7 +963,7 @@ def response_float(self, *, scenario: str, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1013,7 +1018,7 @@ def param_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1063,7 +1068,7 @@ def response_double( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1118,7 +1123,7 @@ def param_bool( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1166,7 +1171,7 @@ def response_bool(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1222,7 +1227,7 @@ def param_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1272,7 +1277,7 @@ def response_string( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1327,7 +1332,7 @@ def param_date( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1375,7 +1380,7 @@ def response_date(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1431,7 +1436,7 @@ def param_datetime( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1481,7 +1486,7 @@ def response_datetime( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1537,7 +1542,7 @@ def param_datetime_rfc1123( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1588,7 +1593,7 @@ def response_datetime_rfc1123( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1641,7 +1646,7 @@ def param_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1690,7 +1695,7 @@ def response_duration( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1743,7 +1748,7 @@ def param_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1790,7 +1795,7 @@ def response_byte(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1846,7 +1851,7 @@ def param_enum( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1894,7 +1899,7 @@ def response_enum(self, *, scenario: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1942,7 +1947,7 @@ def custom_request_id(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py index d1c5fde3206..2a9eef3a3e8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, cast +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -170,7 +170,7 @@ async def get_empty_error(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,7 +220,7 @@ async def get_no_model_error(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,7 +270,7 @@ async def get_no_model_empty(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,7 +338,7 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -381,7 +381,7 @@ async def get200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +431,7 @@ async def options200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,7 +486,7 @@ async def put200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +542,7 @@ async def patch200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -598,7 +598,7 @@ async def post200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,7 +654,7 @@ async def delete200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -710,7 +710,7 @@ async def put201( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -766,7 +766,7 @@ async def post201( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -822,7 +822,7 @@ async def put202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -878,7 +878,7 @@ async def patch202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -934,7 +934,7 @@ async def post202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +990,7 @@ async def delete202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1041,7 +1041,7 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1089,7 @@ async def put204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1145,7 +1145,7 @@ async def patch204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1201,7 @@ async def post204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1257,7 +1257,7 @@ async def delete204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1308,7 +1308,7 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1369,7 +1369,7 @@ async def head300(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1424,7 +1424,7 @@ async def get300(self, **kwargs: Any) -> Optional[List[str]]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1479,7 +1479,7 @@ async def head301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1526,7 +1526,7 @@ async def get301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1579,7 +1579,7 @@ async def put301( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1633,7 +1633,7 @@ async def head302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1680,7 +1680,7 @@ async def get302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1733,7 +1733,7 @@ async def patch302( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1793,7 +1793,7 @@ async def post303( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1848,7 +1848,7 @@ async def head307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1895,7 +1895,7 @@ async def get307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1942,7 +1942,7 @@ async def options307(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1994,7 +1994,7 @@ async def put307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2054,7 +2054,7 @@ async def patch307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2114,7 +2114,7 @@ async def post307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2174,7 +2174,7 @@ async def delete307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2247,7 +2247,7 @@ async def head400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2290,7 +2290,7 @@ async def get400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2333,7 +2333,7 @@ async def options400(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2381,7 +2381,7 @@ async def put400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2437,7 +2437,7 @@ async def patch400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2493,7 +2493,7 @@ async def post400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2549,7 +2549,7 @@ async def delete400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2600,7 +2600,7 @@ async def head401(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2643,7 +2643,7 @@ async def get402(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2686,7 +2686,7 @@ async def options403(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2729,7 +2729,7 @@ async def get403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2777,7 +2777,7 @@ async def put404( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2833,7 +2833,7 @@ async def patch405( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2889,7 +2889,7 @@ async def post406( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2945,7 +2945,7 @@ async def delete407( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3001,7 +3001,7 @@ async def put409( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3052,7 +3052,7 @@ async def head410(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3095,7 +3095,7 @@ async def get411(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3138,7 +3138,7 @@ async def options412(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3181,7 +3181,7 @@ async def get412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3229,7 +3229,7 @@ async def put413( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3285,7 +3285,7 @@ async def patch414( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3341,7 +3341,7 @@ async def post415( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3392,7 +3392,7 @@ async def get416(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3440,7 +3440,7 @@ async def delete417( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3491,7 +3491,7 @@ async def head429(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3552,7 +3552,7 @@ async def head501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3595,7 +3595,7 @@ async def get501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3643,7 +3643,7 @@ async def post505( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3699,7 +3699,7 @@ async def delete505( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3768,7 +3768,7 @@ async def head408(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3816,7 +3816,7 @@ async def put500( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3872,7 +3872,7 @@ async def patch500( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3923,7 +3923,7 @@ async def get502(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3966,7 +3966,7 @@ async def options502(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4021,7 +4021,7 @@ async def post503( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4077,7 +4077,7 @@ async def delete503( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4133,7 +4133,7 @@ async def put504( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4189,7 +4189,7 @@ async def patch504( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4268,7 +4268,7 @@ async def get200_model204_no_model_default_error200_valid( # pylint: disable=na "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4330,7 +4330,7 @@ async def get200_model204_no_model_default_error204_valid( # pylint: disable=na "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4392,7 +4392,7 @@ async def get200_model204_no_model_default_error201_invalid( # pylint: disable= "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4454,7 +4454,7 @@ async def get200_model204_no_model_default_error202_none( # pylint: disable=nam "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4516,7 +4516,7 @@ async def get200_model204_no_model_default_error400_valid( # pylint: disable=na "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4583,7 +4583,7 @@ async def get200_model201_model_default_error200_valid( # pylint: disable=name- "textStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4655,7 +4655,7 @@ async def get200_model201_model_default_error201_valid( # pylint: disable=name- "textStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4727,7 +4727,7 @@ async def get200_model201_model_default_error400_valid( # pylint: disable=name- "textStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4802,7 +4802,7 @@ async def get200_model_a201_model_c404_model_d_default_error200_valid( # pylint "httpStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4883,7 +4883,7 @@ async def get200_model_a201_model_c404_model_d_default_error201_valid( # pylint "httpStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4964,7 +4964,7 @@ async def get200_model_a201_model_c404_model_d_default_error404_valid( # pylint "httpStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5045,7 +5045,7 @@ async def get200_model_a201_model_c404_model_d_default_error400_valid( # pylint "httpStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5110,7 +5110,7 @@ async def get202_none204_none_default_error202_none( # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5155,7 +5155,7 @@ async def get202_none204_none_default_error204_none( # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5200,7 +5200,7 @@ async def get202_none204_none_default_error400_valid( # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5245,7 +5245,7 @@ async def get202_none204_none_default_none202_invalid( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5290,7 +5290,7 @@ async def get202_none204_none_default_none204_none( # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5335,7 +5335,7 @@ async def get202_none204_none_default_none400_none( # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5380,7 +5380,7 @@ async def get202_none204_none_default_none400_invalid( # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5431,7 +5431,7 @@ async def get_default_model_a200_valid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5489,7 +5489,7 @@ async def get_default_model_a200_none(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5541,7 +5541,7 @@ async def get_default_model_a400_valid( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5586,7 +5586,7 @@ async def get_default_model_a400_none( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5631,7 +5631,7 @@ async def get_default_none200_invalid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5674,7 +5674,7 @@ async def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5719,7 +5719,7 @@ async def get_default_none400_invalid( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5762,7 +5762,7 @@ async def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5814,7 +5814,7 @@ async def get200_model_a200_none(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5872,7 +5872,7 @@ async def get200_model_a200_valid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5930,7 +5930,7 @@ async def get200_model_a200_invalid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5988,7 +5988,7 @@ async def get200_model_a400_none(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6046,7 +6046,7 @@ async def get200_model_a400_valid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6104,7 +6104,7 @@ async def get200_model_a400_invalid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6162,7 +6162,7 @@ async def get200_model_a202_valid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py index a29beee8493..4aeb50897c2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, cast +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -1775,7 +1775,7 @@ def get_empty_error(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1825,7 +1825,7 @@ def get_no_model_error(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1875,7 +1875,7 @@ def get_no_model_empty(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1943,7 +1943,7 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1986,7 +1986,7 @@ def get200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2036,7 +2036,7 @@ def options200(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2091,7 +2091,7 @@ def put200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2147,7 +2147,7 @@ def patch200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2203,7 +2203,7 @@ def post200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2259,7 +2259,7 @@ def delete200( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2315,7 +2315,7 @@ def put201( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2371,7 +2371,7 @@ def post201( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2427,7 +2427,7 @@ def put202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2483,7 +2483,7 @@ def patch202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2539,7 +2539,7 @@ def post202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2595,7 +2595,7 @@ def delete202( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2646,7 +2646,7 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2694,7 +2694,7 @@ def put204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2750,7 +2750,7 @@ def patch204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2806,7 +2806,7 @@ def post204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2862,7 +2862,7 @@ def delete204( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2913,7 +2913,7 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2974,7 +2974,7 @@ def head300(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3029,7 +3029,7 @@ def get300(self, **kwargs: Any) -> Optional[List[str]]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3084,7 +3084,7 @@ def head301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3131,7 +3131,7 @@ def get301(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3184,7 +3184,7 @@ def put301( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3238,7 +3238,7 @@ def head302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3285,7 +3285,7 @@ def get302(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3338,7 +3338,7 @@ def patch302( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3398,7 +3398,7 @@ def post303( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3453,7 +3453,7 @@ def head307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3500,7 +3500,7 @@ def get307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3547,7 +3547,7 @@ def options307(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3599,7 +3599,7 @@ def put307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3659,7 +3659,7 @@ def patch307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3719,7 +3719,7 @@ def post307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3779,7 +3779,7 @@ def delete307( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3852,7 +3852,7 @@ def head400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3895,7 +3895,7 @@ def get400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3938,7 +3938,7 @@ def options400(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3986,7 +3986,7 @@ def put400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4042,7 +4042,7 @@ def patch400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4098,7 +4098,7 @@ def post400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4154,7 +4154,7 @@ def delete400( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4205,7 +4205,7 @@ def head401(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4248,7 +4248,7 @@ def get402(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4291,7 +4291,7 @@ def options403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4334,7 +4334,7 @@ def get403(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4382,7 +4382,7 @@ def put404( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4438,7 +4438,7 @@ def patch405( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4494,7 +4494,7 @@ def post406( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4550,7 +4550,7 @@ def delete407( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4606,7 +4606,7 @@ def put409( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4657,7 +4657,7 @@ def head410(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4700,7 +4700,7 @@ def get411(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4743,7 +4743,7 @@ def options412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4786,7 +4786,7 @@ def get412(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4834,7 +4834,7 @@ def put413( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4890,7 +4890,7 @@ def patch414( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4946,7 +4946,7 @@ def post415( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4997,7 +4997,7 @@ def get416(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5045,7 +5045,7 @@ def delete417( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5096,7 +5096,7 @@ def head429(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5157,7 +5157,7 @@ def head501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5200,7 +5200,7 @@ def get501(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5248,7 +5248,7 @@ def post505( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5304,7 +5304,7 @@ def delete505( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5373,7 +5373,7 @@ def head408(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5421,7 +5421,7 @@ def put500( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5477,7 +5477,7 @@ def patch500( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5528,7 +5528,7 @@ def get502(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5571,7 +5571,7 @@ def options502(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5626,7 +5626,7 @@ def post503( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5682,7 +5682,7 @@ def delete503( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5738,7 +5738,7 @@ def put504( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5794,7 +5794,7 @@ def patch504( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5873,7 +5873,7 @@ def get200_model204_no_model_default_error200_valid( # pylint: disable=name-too "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5935,7 +5935,7 @@ def get200_model204_no_model_default_error204_valid( # pylint: disable=name-too "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5997,7 +5997,7 @@ def get200_model204_no_model_default_error201_invalid( # pylint: disable=name-t "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6059,7 +6059,7 @@ def get200_model204_no_model_default_error202_none( # pylint: disable=name-too- "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6121,7 +6121,7 @@ def get200_model204_no_model_default_error400_valid( # pylint: disable=name-too "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6186,7 +6186,7 @@ def get200_model201_model_default_error200_valid(self, **kwargs: Any) -> JSON: "textStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6256,7 +6256,7 @@ def get200_model201_model_default_error201_valid(self, **kwargs: Any) -> JSON: "textStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6326,7 +6326,7 @@ def get200_model201_model_default_error400_valid(self, **kwargs: Any) -> JSON: "textStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6401,7 +6401,7 @@ def get200_model_a201_model_c404_model_d_default_error200_valid( # pylint: disa "httpStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6482,7 +6482,7 @@ def get200_model_a201_model_c404_model_d_default_error201_valid( # pylint: disa "httpStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6563,7 +6563,7 @@ def get200_model_a201_model_c404_model_d_default_error404_valid( # pylint: disa "httpStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6644,7 +6644,7 @@ def get200_model_a201_model_c404_model_d_default_error400_valid( # pylint: disa "httpStatusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6709,7 +6709,7 @@ def get202_none204_none_default_error202_none( # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6754,7 +6754,7 @@ def get202_none204_none_default_error204_none( # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6799,7 +6799,7 @@ def get202_none204_none_default_error400_valid( # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6844,7 +6844,7 @@ def get202_none204_none_default_none202_invalid( # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6889,7 +6889,7 @@ def get202_none204_none_default_none204_none( # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6934,7 +6934,7 @@ def get202_none204_none_default_none400_none( # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6979,7 +6979,7 @@ def get202_none204_none_default_none400_invalid( # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7030,7 +7030,7 @@ def get_default_model_a200_valid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7088,7 +7088,7 @@ def get_default_model_a200_none(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7138,7 +7138,7 @@ def get_default_model_a400_valid(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7181,7 +7181,7 @@ def get_default_model_a400_none(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7224,7 +7224,7 @@ def get_default_none200_invalid(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7267,7 +7267,7 @@ def get_default_none200_none(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7310,7 +7310,7 @@ def get_default_none400_invalid(self, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7353,7 +7353,7 @@ def get_default_none400_none(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7405,7 +7405,7 @@ def get200_model_a200_none(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7463,7 +7463,7 @@ def get200_model_a200_valid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7521,7 +7521,7 @@ def get200_model_a200_invalid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7579,7 +7579,7 @@ def get200_model_a400_none(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7637,7 +7637,7 @@ def get200_model_a400_valid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7695,7 +7695,7 @@ def get200_model_a400_invalid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7753,7 +7753,7 @@ def get200_model_a202_valid(self, **kwargs: Any) -> JSON: "statusCode": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py index 5c416da1351..f04a7bed709 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import IncorrectReturnedErrorModelMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +54,7 @@ def get_incorrect_error_from_server(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py index aba76670b64..44aa4d13527 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_incorrect_returned_error_model_get_incorrect_error_from_server_request from .._vendor import IncorrectReturnedErrorModelMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,7 @@ async def get_incorrect_error_from_server( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py index ab0cb8ed96f..f1f0c74c265 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -214,7 +214,7 @@ def analyze_body(self, input: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: "source": "str" # Optional. File source path. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +341,7 @@ def analyze_body_no_accept_header( # pylint: disable=inconsistent-return-statem "source": "str" # Optional. File source path. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +406,7 @@ def content_type_with_encoding(self, input: Optional[str] = None, **kwargs: Any) :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,7 +467,7 @@ def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: Any) :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +526,7 @@ def binary_body_with_three_content_types(self, message: IO[bytes], **kwargs: Any :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,7 +583,7 @@ def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py index 02a999d9d50..19b3fc5f8fe 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -109,7 +109,7 @@ async def analyze_body(self, input: Optional[Union[JSON, IO[bytes]]] = None, **k "source": "str" # Optional. File source path. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +236,7 @@ async def analyze_body_no_accept_header( # pylint: disable=inconsistent-return- "source": "str" # Optional. File source path. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +301,7 @@ async def content_type_with_encoding(self, input: Optional[str] = None, **kwargs :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -362,7 +362,7 @@ async def binary_body_with_two_content_types(self, message: IO[bytes], **kwargs: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -421,7 +421,7 @@ async def binary_body_with_three_content_types(self, message: IO[bytes], **kwarg :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -478,7 +478,7 @@ async def put_text_and_json_body(self, message: str, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py index 81097012fe5..a1581815ba7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -67,7 +67,7 @@ def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py index f4464e46754..c6a2493d71d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -45,7 +45,7 @@ async def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py index 7d3145e1ae7..76644636bda 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -313,7 +313,7 @@ def put_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -399,7 +399,7 @@ def get_array(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +508,7 @@ def put_wrapped_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -582,7 +582,7 @@ def get_wrapped_array(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -707,7 +707,7 @@ def put_dictionary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -793,7 +793,7 @@ def get_dictionary(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1035,7 +1035,7 @@ def put_resource_collection( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1166,7 +1166,7 @@ def get_resource_collection(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1362,7 +1362,7 @@ def put_simple_product(self, simple_body_product: Optional[Union[JSON, IO[bytes] } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1575,7 +1575,7 @@ def post_flattened_simple_product( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1804,7 +1804,7 @@ def put_simple_product_with_grouping( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py index 1cbb2d0b8cc..e84eb42ffa4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -120,7 +120,7 @@ async def put_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +206,7 @@ async def get_array(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +315,7 @@ async def put_wrapped_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +389,7 @@ async def get_wrapped_array(self, **kwargs: Any) -> List[JSON]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,7 +514,7 @@ async def put_dictionary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -600,7 +600,7 @@ async def get_dictionary(self, **kwargs: Any) -> Dict[str, JSON]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -842,7 +842,7 @@ async def put_resource_collection( # pylint: disable=inconsistent-return-statem } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -973,7 +973,7 @@ async def get_resource_collection(self, **kwargs: Any) -> JSON: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1171,7 +1171,7 @@ async def put_simple_product( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1384,7 +1384,7 @@ async def post_flattened_simple_product( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1613,7 +1613,7 @@ async def put_simple_product_with_grouping( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py index 8a4dcb503f8..416ba8b0de4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -221,7 +221,7 @@ def get_horse(self, **kwargs: Any) -> JSON: "isAShowHorse": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,7 +320,7 @@ def put_horse(self, horse: Union[JSON, IO[bytes]], **kwargs: Any) -> str: "isAShowHorse": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,7 +390,7 @@ def get_pet(self, **kwargs: Any) -> JSON: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,7 +486,7 @@ def put_pet(self, pet: Union[JSON, IO[bytes]], **kwargs: Any) -> str: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -557,7 +557,7 @@ def get_feline(self, **kwargs: Any) -> JSON: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +656,7 @@ def put_feline(self, feline: Union[JSON, IO[bytes]], **kwargs: Any) -> str: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -729,7 +729,7 @@ def get_cat(self, **kwargs: Any) -> JSON: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -834,7 +834,7 @@ def put_cat(self, cat: Union[JSON, IO[bytes]], **kwargs: Any) -> str: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -909,7 +909,7 @@ def get_kitten(self, **kwargs: Any) -> JSON: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1019,7 +1019,7 @@ def put_kitten(self, kitten: Union[JSON, IO[bytes]], **kwargs: Any) -> str: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py index 74dd160bf48..f1ebe04cc0f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -66,7 +66,7 @@ async def get_horse(self, **kwargs: Any) -> JSON: "isAShowHorse": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +165,7 @@ async def put_horse(self, horse: Union[JSON, IO[bytes]], **kwargs: Any) -> str: "isAShowHorse": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -235,7 +235,7 @@ async def get_pet(self, **kwargs: Any) -> JSON: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +331,7 @@ async def put_pet(self, pet: Union[JSON, IO[bytes]], **kwargs: Any) -> str: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,7 +402,7 @@ async def get_feline(self, **kwargs: Any) -> JSON: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -501,7 +501,7 @@ async def put_feline(self, feline: Union[JSON, IO[bytes]], **kwargs: Any) -> str "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +574,7 @@ async def get_cat(self, **kwargs: Any) -> JSON: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,7 +679,7 @@ async def put_cat(self, cat: Union[JSON, IO[bytes]], **kwargs: Any) -> str: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -754,7 +754,7 @@ async def get_kitten(self, **kwargs: Any) -> JSON: "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -864,7 +864,7 @@ async def put_kitten(self, kitten: Union[JSON, IO[bytes]], **kwargs: Any) -> str "meows": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_operations.py index 20781573ea3..500a58d58f9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import AnythingClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -125,7 +130,7 @@ def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +183,7 @@ def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -226,7 +231,7 @@ def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -279,7 +284,7 @@ def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,7 +332,7 @@ def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -380,7 +385,7 @@ def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_operations.py index fb311be4cf3..04b83dc94f7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ ) from .._vendor import AnythingClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ async def get_object(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +103,7 @@ async def put_object(self, input: Any, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +151,7 @@ async def get_string(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +204,7 @@ async def put_string(self, input: Any, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -247,7 +252,7 @@ async def get_array(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +305,7 @@ async def put_array(self, input: Any, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py index 7d0037dbb85..00d9bccf7eb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ build_int_operations_put_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def put(self, input: Optional[int] = None, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +123,7 @@ async def get(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,7 +194,7 @@ async def put(self, input: Optional[float] = None, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -247,7 +252,7 @@ async def get(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py index 47b49bf055f..7d8fb816ab7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -120,7 +125,7 @@ def put(self, input: Optional[int] = None, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +183,7 @@ def get(self, **kwargs: Any) -> int: :rtype: int :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -249,7 +254,7 @@ def put(self, input: Optional[float] = None, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,7 +312,7 @@ def get(self, **kwargs: Any) -> float: :rtype: float :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py index 7dbc80832ce..d243bbfe593 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -78,7 +78,7 @@ def get(self, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +132,7 @@ def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py index f0d28b62481..805d0b37ea2 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -44,7 +44,7 @@ async def get(self, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +98,7 @@ async def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py index ff68abe6a10..8f6c08a407b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -133,7 +133,7 @@ async def update( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py index d614539b178..c0840593c8f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -156,7 +156,7 @@ def update( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py index fc705b9f0d1..c3dacbab52c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import ParmaterizedEndpointClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py index c898cc85713..12d4aaa7376 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_parmaterized_endpoint_get_request from .._vendor import ParmaterizedEndpointClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +41,7 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py index b2f8509de85..af4555a2bf1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import AutoRestReportServiceMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +99,7 @@ def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> Dict[ "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py index e07cc0bce33..8d89ccf2922 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar, cast +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ ) from .._vendor import AutoRestReportServiceMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ async def get_report(self, *, qualifier: Optional[str] = None, **kwargs: Any) -> "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +119,7 @@ async def get_optional_report(self, *, qualifier: Optional[str] = None, **kwargs "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py index 876d4e78ec2..d9f02906b38 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -96,7 +96,7 @@ async def get_required_path( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +144,7 @@ async def put_optional_query( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +192,7 @@ async def put_optional_header( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,7 +240,7 @@ async def put_optional_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +295,7 @@ async def put_optional_binary_body( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -343,7 +343,7 @@ async def get_required_global_path(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -387,7 +387,7 @@ async def get_required_global_query(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +431,7 @@ async def get_optional_global_query(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +497,7 @@ async def put_optional_binary_body( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -549,7 +549,7 @@ async def put_required_binary_body( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -602,7 +602,7 @@ async def post_required_integer_parameter( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -654,7 +654,7 @@ async def post_optional_integer_parameter( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -760,7 +760,7 @@ async def post_required_integer_property( # pylint: disable=inconsistent-return "value": 0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -867,7 +867,7 @@ async def post_optional_integer_property( # pylint: disable=inconsistent-return "value": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -930,7 +930,7 @@ async def post_required_integer_header( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -978,7 +978,7 @@ async def post_optional_integer_header( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1027,7 +1027,7 @@ async def post_required_string_parameter( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1079,7 +1079,7 @@ async def post_optional_string_parameter( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1185,7 +1185,7 @@ async def post_required_string_property( # pylint: disable=inconsistent-return- "value": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1292,7 +1292,7 @@ async def post_optional_string_property( # pylint: disable=inconsistent-return- "value": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1355,7 +1355,7 @@ async def post_required_string_header( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1403,7 +1403,7 @@ async def post_optional_string_header( # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1504,7 +1504,7 @@ async def post_required_class_parameter( # pylint: disable=inconsistent-return- "name": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1613,7 +1613,7 @@ async def post_optional_class_parameter( # pylint: disable=inconsistent-return- "name": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1732,7 +1732,7 @@ async def post_required_class_property( # pylint: disable=inconsistent-return-s } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1845,7 +1845,7 @@ async def post_optional_class_property( # pylint: disable=inconsistent-return-s } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1950,7 +1950,7 @@ async def post_required_array_parameter( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2049,7 +2049,7 @@ async def post_optional_array_parameter( # pylint: disable=inconsistent-return- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2166,7 +2166,7 @@ async def post_required_array_property( # pylint: disable=inconsistent-return-s ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2277,7 +2277,7 @@ async def post_optional_array_property( # pylint: disable=inconsistent-return-s ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2340,7 +2340,7 @@ async def post_required_array_header( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2388,7 +2388,7 @@ async def post_optional_array_header( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py index 06aee3fa0df..d2852be403d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -649,7 +649,7 @@ def get_required_path( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -697,7 +697,7 @@ def put_optional_query( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -745,7 +745,7 @@ def put_optional_header( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -793,7 +793,7 @@ def put_optional_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -848,7 +848,7 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -896,7 +896,7 @@ def get_required_global_path(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -940,7 +940,7 @@ def get_required_global_query(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +984,7 @@ def get_optional_global_query(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1050,7 +1050,7 @@ def put_optional_binary_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1102,7 +1102,7 @@ def put_required_binary_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1155,7 +1155,7 @@ def post_required_integer_parameter( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1207,7 +1207,7 @@ def post_optional_integer_parameter( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1313,7 +1313,7 @@ def post_required_integer_property( # pylint: disable=inconsistent-return-state "value": 0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1420,7 +1420,7 @@ def post_optional_integer_property( # pylint: disable=inconsistent-return-state "value": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1483,7 +1483,7 @@ def post_required_integer_header( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1531,7 +1531,7 @@ def post_optional_integer_header( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1580,7 +1580,7 @@ def post_required_string_parameter( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1632,7 +1632,7 @@ def post_optional_string_parameter( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1738,7 +1738,7 @@ def post_required_string_property( # pylint: disable=inconsistent-return-statem "value": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1845,7 +1845,7 @@ def post_optional_string_property( # pylint: disable=inconsistent-return-statem "value": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1908,7 +1908,7 @@ def post_required_string_header( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1956,7 +1956,7 @@ def post_optional_string_header( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2057,7 +2057,7 @@ def post_required_class_parameter( # pylint: disable=inconsistent-return-statem "name": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2166,7 +2166,7 @@ def post_optional_class_parameter( # pylint: disable=inconsistent-return-statem "name": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2285,7 +2285,7 @@ def post_required_class_property( # pylint: disable=inconsistent-return-stateme } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2398,7 +2398,7 @@ def post_optional_class_property( # pylint: disable=inconsistent-return-stateme } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2503,7 +2503,7 @@ def post_required_array_parameter( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2602,7 +2602,7 @@ def post_optional_array_parameter( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2719,7 +2719,7 @@ def post_required_array_property( # pylint: disable=inconsistent-return-stateme ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2830,7 +2830,7 @@ def post_optional_array_property( # pylint: disable=inconsistent-return-stateme ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2893,7 +2893,7 @@ def post_required_array_header( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2941,7 +2941,7 @@ def post_optional_array_header( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py index 499fc7975b9..d3a51979634 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, cast +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -67,7 +67,7 @@ async def operation_one(self, *, parameter1: str, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +131,7 @@ async def operation_with_content_param(self, content: IO[bytes], **kwargs: Any) :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -188,7 +188,7 @@ async def operation_with_json_param(self, json: Any, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +254,7 @@ async def operation_with_url( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +310,7 @@ async def reserved_enum(self, *, enum_parameter: str, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py index c9900e698d0..e69f1d0e25a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, cast +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -168,7 +168,7 @@ def operation_one(self, *, parameter1: str, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -232,7 +232,7 @@ def operation_with_content_param(self, content: IO[bytes], **kwargs: Any) -> JSO :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +289,7 @@ def operation_with_json_param(self, json: Any, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -355,7 +355,7 @@ def operation_with_url( :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +411,7 @@ def reserved_enum(self, *, enum_parameter: str, **kwargs: Any) -> JSON: :rtype: JSON :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_operations.py index 8b8a01ae464..3ee60e15dd8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import AutorestSecurityAadMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_operations.py index 42b772d09d4..71ea32b39a6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_autorest_security_aad_head_request from .._vendor import AutorestSecurityAadMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +41,7 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_operations.py index 1a87e856ac6..7ffbaf3a913 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import AutorestSecurityKeyMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_operations.py index a5758f28c1b..0a56ebc0a6d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_autorest_security_key_head_request from .._vendor import AutorestSecurityKeyMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +41,7 @@ async def head(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py index 83225b97fc9..63db587f63f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ build_queries_array_string_multi_valid_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def array_string_multi_null( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def array_string_multi_empty( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ async def array_string_multi_valid( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py index 81d22248c7c..cffc288b9c6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_operations.py @@ -6,7 +6,8 @@ # 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, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -129,7 +134,7 @@ def array_string_multi_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -178,7 +183,7 @@ def array_string_multi_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -228,7 +233,7 @@ def array_string_multi_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py index defebfacb2f..af0e15ee2b5 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -91,6 +92,10 @@ build_queries_string_url_encoded_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -120,7 +125,7 @@ async def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +170,7 @@ async def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +215,7 @@ async def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +262,7 @@ async def get_int_negative_one_million( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +307,7 @@ async def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +352,7 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -392,7 +397,7 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +442,7 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +487,7 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -527,7 +532,7 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +577,7 @@ async def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,7 +622,7 @@ async def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -664,7 +669,7 @@ async def string_url_non_encoded(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,7 +714,7 @@ async def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -758,7 +763,7 @@ async def string_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -805,7 +810,7 @@ async def enum_valid(self, enum_path: str, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -852,7 +857,7 @@ async def enum_null(self, enum_path: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -900,7 +905,7 @@ async def byte_multi_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -944,7 +949,7 @@ async def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -993,7 +998,7 @@ async def byte_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1037,7 +1042,7 @@ async def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1087,7 +1092,7 @@ async def date_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1131,7 +1136,7 @@ async def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1180,7 +1185,7 @@ async def date_time_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1228,7 +1233,7 @@ async def base64_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1278,7 +1283,7 @@ async def array_csv_in_path( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1326,7 +1331,7 @@ async def unix_time_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1388,7 +1393,7 @@ async def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1433,7 +1438,7 @@ async def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1482,7 +1487,7 @@ async def get_boolean_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1526,7 +1531,7 @@ async def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1573,7 +1578,7 @@ async def get_int_negative_one_million( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1622,7 +1627,7 @@ async def get_int_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1666,7 +1671,7 @@ async def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1711,7 +1716,7 @@ async def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1760,7 +1765,7 @@ async def get_long_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1804,7 +1809,7 @@ async def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1849,7 +1854,7 @@ async def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1898,7 +1903,7 @@ async def float_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1942,7 +1947,7 @@ async def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1987,7 +1992,7 @@ async def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2036,7 +2041,7 @@ async def double_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2080,7 +2085,7 @@ async def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2125,7 +2130,7 @@ async def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2172,7 +2177,7 @@ async def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2221,7 +2226,7 @@ async def string_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2270,7 +2275,7 @@ async def enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2319,7 +2324,7 @@ async def enum_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2368,7 +2373,7 @@ async def byte_multi_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2412,7 +2417,7 @@ async def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2461,7 +2466,7 @@ async def byte_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2505,7 +2510,7 @@ async def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2554,7 +2559,7 @@ async def date_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2598,7 +2603,7 @@ async def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2649,7 +2654,7 @@ async def date_time_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2699,7 +2704,7 @@ async def array_string_csv_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2747,7 +2752,7 @@ async def array_string_csv_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2796,7 +2801,7 @@ async def array_string_csv_empty( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2846,7 +2851,7 @@ async def array_string_no_collection_format_empty( # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2896,7 +2901,7 @@ async def array_string_ssv_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2946,7 +2951,7 @@ async def array_string_tsv_valid( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2996,7 +3001,7 @@ async def array_string_pipes_valid( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3078,7 +3083,7 @@ async def get_all_with_values( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3147,7 +3152,7 @@ async def get_global_query_null( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3216,7 +3221,7 @@ async def get_global_and_local_query_null( # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3284,7 +3289,7 @@ async def get_local_path_item_query_null( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py index 2d11a31c6ca..43aa564382e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1429,7 +1434,7 @@ def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1474,7 +1479,7 @@ def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1519,7 +1524,7 @@ def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1564,7 +1569,7 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1609,7 +1614,7 @@ def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1654,7 +1659,7 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1699,7 +1704,7 @@ def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1744,7 +1749,7 @@ def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1789,7 +1794,7 @@ def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1834,7 +1839,7 @@ def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1879,7 +1884,7 @@ def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1924,7 +1929,7 @@ def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1971,7 +1976,7 @@ def string_url_non_encoded(self, **kwargs: Any) -> None: # pylint: disable=inco :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2016,7 +2021,7 @@ def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2063,7 +2068,7 @@ def string_null(self, string_path: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2110,7 +2115,7 @@ def enum_valid(self, enum_path: str, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2157,7 +2162,7 @@ def enum_null(self, enum_path: str, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2205,7 +2210,7 @@ def byte_multi_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2249,7 +2254,7 @@ def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2296,7 +2301,7 @@ def byte_null(self, byte_path: bytes, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2340,7 +2345,7 @@ def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2390,7 +2395,7 @@ def date_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2434,7 +2439,7 @@ def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2483,7 +2488,7 @@ def date_time_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2531,7 +2536,7 @@ def base64_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2581,7 +2586,7 @@ def array_csv_in_path( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2629,7 +2634,7 @@ def unix_time_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2691,7 +2696,7 @@ def get_boolean_true(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2736,7 +2741,7 @@ def get_boolean_false(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2785,7 +2790,7 @@ def get_boolean_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2829,7 +2834,7 @@ def get_int_one_million(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2874,7 +2879,7 @@ def get_int_negative_one_million(self, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2923,7 +2928,7 @@ def get_int_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2967,7 +2972,7 @@ def get_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3012,7 +3017,7 @@ def get_negative_ten_billion(self, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3061,7 +3066,7 @@ def get_long_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3105,7 +3110,7 @@ def float_scientific_positive(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3150,7 +3155,7 @@ def float_scientific_negative(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3199,7 +3204,7 @@ def float_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3243,7 +3248,7 @@ def double_decimal_positive(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3288,7 +3293,7 @@ def double_decimal_negative(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3337,7 +3342,7 @@ def double_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3381,7 +3386,7 @@ def string_unicode(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3426,7 +3431,7 @@ def string_url_encoded(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3473,7 +3478,7 @@ def string_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3522,7 +3527,7 @@ def string_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3571,7 +3576,7 @@ def enum_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3620,7 +3625,7 @@ def enum_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3669,7 +3674,7 @@ def byte_multi_byte( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3713,7 +3718,7 @@ def byte_empty(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3762,7 +3767,7 @@ def byte_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3806,7 +3811,7 @@ def date_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3855,7 +3860,7 @@ def date_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3899,7 +3904,7 @@ def date_time_valid(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3950,7 +3955,7 @@ def date_time_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4000,7 +4005,7 @@ def array_string_csv_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4048,7 +4053,7 @@ def array_string_csv_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4097,7 +4102,7 @@ def array_string_csv_empty( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4147,7 +4152,7 @@ def array_string_no_collection_format_empty( # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4197,7 +4202,7 @@ def array_string_ssv_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4247,7 +4252,7 @@ def array_string_tsv_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4297,7 +4302,7 @@ def array_string_pipes_valid( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4379,7 +4384,7 @@ def get_all_with_values( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4448,7 +4453,7 @@ def get_global_query_null( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4517,7 +4522,7 @@ def get_global_and_local_query_null( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4585,7 +4590,7 @@ def get_local_path_item_query_null( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py index 21971d78560..94383716b5d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -185,7 +185,7 @@ def validation_of_method_parameters(self, resource_group_name: str, id: int, **k "image": "str" # Optional. Image URL representing the product. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +444,7 @@ def validation_of_body( "image": "str" # Optional. Image URL representing the product. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,7 +513,7 @@ def get_with_constant_in_path(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -734,7 +734,7 @@ def post_with_constant_in_body(self, body: Optional[Union[JSON, IO[bytes]]] = No "image": "str" # Optional. Image URL representing the product. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py index 7dc34d2d733..9a745ea9495 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -84,7 +84,7 @@ async def validation_of_method_parameters(self, resource_group_name: str, id: in "image": "str" # Optional. Image URL representing the product. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -343,7 +343,7 @@ async def validation_of_body( "image": "str" # Optional. Image URL representing the product. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +412,7 @@ async def get_with_constant_in_path(self, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +633,7 @@ async def post_with_constant_in_body(self, body: Optional[Union[JSON, IO[bytes]] "image": "str" # Optional. Image URL representing the product. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py index 76550ccf4a1..4aced3cb394 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -60,6 +61,10 @@ build_xml_put_wrapped_lists_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +96,7 @@ async def get_complex_type_ref_no_meta(self, **kwargs: Any) -> _models.RootWithR :rtype: ~xmlserviceversiontolerant.models.RootWithRefAndNoMeta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -142,7 +147,7 @@ async def put_complex_type_ref_no_meta( # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +195,7 @@ async def get_complex_type_ref_with_meta(self, **kwargs: Any) -> _models.RootWit :rtype: ~xmlserviceversiontolerant.models.RootWithRefAndMeta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,7 +246,7 @@ async def put_complex_type_ref_with_meta( # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +294,7 @@ async def get_simple(self, **kwargs: Any) -> _models.Slideshow: :rtype: ~xmlserviceversiontolerant.models.Slideshow :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +346,7 @@ async def put_simple( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,7 +395,7 @@ async def get_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: :rtype: ~xmlserviceversiontolerant.models.AppleBarrel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +446,7 @@ async def put_wrapped_lists( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,7 +495,7 @@ async def get_headers(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +541,7 @@ async def get_empty_list(self, **kwargs: Any) -> _models.Slideshow: :rtype: ~xmlserviceversiontolerant.models.Slideshow :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -587,7 +592,7 @@ async def put_empty_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -635,7 +640,7 @@ async def get_empty_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: :rtype: ~xmlserviceversiontolerant.models.AppleBarrel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -686,7 +691,7 @@ async def put_empty_wrapped_lists( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -734,7 +739,7 @@ async def get_root_list(self, **kwargs: Any) -> List[_models.Banana]: :rtype: ~xmlserviceversiontolerant.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -785,7 +790,7 @@ async def put_root_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -834,7 +839,7 @@ async def get_root_list_single_item(self, **kwargs: Any) -> List[_models.Banana] :rtype: ~xmlserviceversiontolerant.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,7 +890,7 @@ async def put_root_list_single_item( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -934,7 +939,7 @@ async def get_empty_root_list(self, **kwargs: Any) -> List[_models.Banana]: :rtype: ~xmlserviceversiontolerant.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -985,7 +990,7 @@ async def put_empty_root_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1034,7 +1039,7 @@ async def get_empty_child_element(self, **kwargs: Any) -> _models.Banana: :rtype: ~xmlserviceversiontolerant.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1085,7 +1090,7 @@ async def put_empty_child_element( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1133,7 +1138,7 @@ async def list_containers(self, **kwargs: Any) -> _models.ListContainersResponse :rtype: ~xmlserviceversiontolerant.models.ListContainersResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1182,7 +1187,7 @@ async def get_service_properties(self, **kwargs: Any) -> _models.StorageServiceP :rtype: ~xmlserviceversiontolerant.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1237,7 +1242,7 @@ async def put_service_properties( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1289,7 +1294,7 @@ async def get_acls(self, **kwargs: Any) -> List[_models.SignedIdentifier]: :rtype: ~xmlserviceversiontolerant.models.SignedIdentifier :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1344,7 +1349,7 @@ async def put_acls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1399,7 +1404,7 @@ async def list_blobs(self, **kwargs: Any) -> _models.ListBlobsResponse: :rtype: ~xmlserviceversiontolerant.models.ListBlobsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1489,7 +1494,7 @@ async def json_input( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1544,7 +1549,7 @@ async def json_output(self, **kwargs: Any) -> _models.JSONOutput: :rtype: ~xmlserviceversiontolerant.models.JSONOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1592,7 +1597,7 @@ async def get_xms_text(self, **kwargs: Any) -> _models.ObjectWithXMsTextProperty :rtype: ~xmlserviceversiontolerant.models.ObjectWithXMsTextProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1639,7 +1644,7 @@ async def get_bytes(self, **kwargs: Any) -> _models.ModelWithByteProperty: :rtype: ~xmlserviceversiontolerant.models.ModelWithByteProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1691,7 +1696,7 @@ async def put_binary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1740,7 +1745,7 @@ async def get_uri(self, **kwargs: Any) -> _models.ModelWithUrlProperty: :rtype: ~xmlserviceversiontolerant.models.ModelWithUrlProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1792,7 +1797,7 @@ async def put_uri( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py index a23ed7e43f2..96ad69aecff 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .. import models as _models 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -590,7 +595,7 @@ def get_complex_type_ref_no_meta(self, **kwargs: Any) -> _models.RootWithRefAndN :rtype: ~xmlserviceversiontolerant.models.RootWithRefAndNoMeta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +646,7 @@ def put_complex_type_ref_no_meta( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -689,7 +694,7 @@ def get_complex_type_ref_with_meta(self, **kwargs: Any) -> _models.RootWithRefAn :rtype: ~xmlserviceversiontolerant.models.RootWithRefAndMeta :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -740,7 +745,7 @@ def put_complex_type_ref_with_meta( # pylint: disable=inconsistent-return-state :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -788,7 +793,7 @@ def get_simple(self, **kwargs: Any) -> _models.Slideshow: :rtype: ~xmlserviceversiontolerant.models.Slideshow :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -840,7 +845,7 @@ def put_simple( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +894,7 @@ def get_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: :rtype: ~xmlserviceversiontolerant.models.AppleBarrel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -940,7 +945,7 @@ def put_wrapped_lists( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -989,7 +994,7 @@ def get_headers(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1035,7 +1040,7 @@ def get_empty_list(self, **kwargs: Any) -> _models.Slideshow: :rtype: ~xmlserviceversiontolerant.models.Slideshow :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1086,7 +1091,7 @@ def put_empty_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1134,7 +1139,7 @@ def get_empty_wrapped_lists(self, **kwargs: Any) -> _models.AppleBarrel: :rtype: ~xmlserviceversiontolerant.models.AppleBarrel :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1185,7 +1190,7 @@ def put_empty_wrapped_lists( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1233,7 +1238,7 @@ def get_root_list(self, **kwargs: Any) -> List[_models.Banana]: :rtype: ~xmlserviceversiontolerant.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1284,7 +1289,7 @@ def put_root_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1333,7 +1338,7 @@ def get_root_list_single_item(self, **kwargs: Any) -> List[_models.Banana]: :rtype: ~xmlserviceversiontolerant.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1384,7 +1389,7 @@ def put_root_list_single_item( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1433,7 +1438,7 @@ def get_empty_root_list(self, **kwargs: Any) -> List[_models.Banana]: :rtype: ~xmlserviceversiontolerant.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1484,7 +1489,7 @@ def put_empty_root_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1533,7 +1538,7 @@ def get_empty_child_element(self, **kwargs: Any) -> _models.Banana: :rtype: ~xmlserviceversiontolerant.models.Banana :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1584,7 +1589,7 @@ def put_empty_child_element( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1632,7 +1637,7 @@ def list_containers(self, **kwargs: Any) -> _models.ListContainersResponse: :rtype: ~xmlserviceversiontolerant.models.ListContainersResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1681,7 +1686,7 @@ def get_service_properties(self, **kwargs: Any) -> _models.StorageServicePropert :rtype: ~xmlserviceversiontolerant.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1736,7 +1741,7 @@ def put_service_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1788,7 +1793,7 @@ def get_acls(self, **kwargs: Any) -> List[_models.SignedIdentifier]: :rtype: ~xmlserviceversiontolerant.models.SignedIdentifier :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1843,7 +1848,7 @@ def put_acls( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1898,7 +1903,7 @@ def list_blobs(self, **kwargs: Any) -> _models.ListBlobsResponse: :rtype: ~xmlserviceversiontolerant.models.ListBlobsResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1988,7 +1993,7 @@ def json_input( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2043,7 +2048,7 @@ def json_output(self, **kwargs: Any) -> _models.JSONOutput: :rtype: ~xmlserviceversiontolerant.models.JSONOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2091,7 +2096,7 @@ def get_xms_text(self, **kwargs: Any) -> _models.ObjectWithXMsTextProperty: :rtype: ~xmlserviceversiontolerant.models.ObjectWithXMsTextProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2138,7 +2143,7 @@ def get_bytes(self, **kwargs: Any) -> _models.ModelWithByteProperty: :rtype: ~xmlserviceversiontolerant.models.ModelWithByteProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2190,7 +2195,7 @@ def put_binary( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2239,7 +2244,7 @@ def get_uri(self, **kwargs: Any) -> _models.ModelWithUrlProperty: :rtype: ~xmlserviceversiontolerant.models.ModelWithUrlProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2291,7 +2296,7 @@ def put_uri( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py index d76055a0b12..28ea0ca8aee 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -72,12 +72,12 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]: "name": "str" # Optional. Gets the Pet by id. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, 400: HttpResponseError, - 404: lambda response: ResourceNotFoundError(response=response), + 404: cast(Type[HttpResponseError], lambda response: ResourceNotFoundError(response=response)), 501: HttpResponseError, } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -137,7 +137,7 @@ async def do_something(self, what_action: str, **kwargs: Any) -> JSON: "actionResponse": "str" # Optional. action feedback. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +195,7 @@ async def has_models_param( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py index ed9eb02d49d..5ff35e13ca9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, TypeVar, cast +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -129,12 +129,12 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]: "name": "str" # Optional. Gets the Pet by id. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 409: ResourceExistsError, 304: ResourceNotModifiedError, 400: HttpResponseError, - 404: lambda response: ResourceNotFoundError(response=response), + 404: cast(Type[HttpResponseError], lambda response: ResourceNotFoundError(response=response)), 501: HttpResponseError, } error_map.update(kwargs.pop("error_map", {}) or {}) @@ -194,7 +194,7 @@ def do_something(self, what_action: str, **kwargs: Any) -> JSON: "actionResponse": "str" # Optional. action feedback. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +252,7 @@ def has_models_param( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/CHANGELOG.md b/packages/typespec-python/CHANGELOG.md index 1c1d776ad8c..b973b673565 100644 --- a/packages/typespec-python/CHANGELOG.md +++ b/packages/typespec-python/CHANGELOG.md @@ -1,5 +1,25 @@ # Release +## 2023-04-05 - 0.23.0 + +| Library | Min Version | +| ----------------------------------------------------------------------- | ------------- | +| `@typespec/compiler` | `0.55.0` | +| `@typespec/http` | `0.55.0` | +| `@typespec/rest` | `0.55.0` | +| `@typespec/versioning` | `0.55.0` | +| `@azure-tools/typespec-azure-core` | `0.41.0` | +| `@azure-tools/typespec-client-generator-core` | `0.41.1` | +| `azure-core` dep of generated code | `1.30.0` | +| `corehttp` dep of generated code | `1.0.0b3` | +| `isodate` dep of generated code | `0.6.1` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.2` | +| `typing-extensions` dep of generated code | `4.6.0` | + +**Other Changes** + +- Refactor code to use the type ecosystem from "@azure-tools/typespec-client-generator-core" #2476 + ## 2023-03-22 - 0.22.5 | Library | Min Version | diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 544d3d509c5..96c07534b52 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -1,87 +1,87 @@ { - "name": "@azure-tools/typespec-python", - "version": "0.22.5", - "author": "Microsoft Corporation", - "description": "TypeSpec emitter for Python SDKs", - "homepage": "https://github.com/Azure/autorest.python", - "readme": "https://github.com/Azure/autorest.python/packages/typespec-python/README.md", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/autorest.python.git" - }, - "bugs": { - "url": "https://github.com/Azure/autorest.python/issues" - }, - "keywords": [ - "typespec" - ], - "type": "module", - "main": "dist/src/index.js", - "exports": { - ".": "./dist/src/index.js", - "./testing": "./dist/src/testing/index.js" - }, - "tspMain": "dist/src/index.js", - "engines": { - "node": ">=14.0.0" - }, - "scripts": { - "clean": "rimraf ./dist ./temp", - "build": "tsc -p .", - "watch": "tsc -p . --watch", - "test": "mocha", - "test-official": "c8 mocha --forbid-only", - "lint": "eslint . --ext .ts --max-warnings=0", - "lint:fix": "eslint . --fix --ext .ts" - }, - "files": [ - "lib/*.cadl", - "dist/**", - "!dist/test/**", - "get-autorest-python-path.cjs" - ], - "peerDependencies": { - "@azure-tools/typespec-azure-core": ">=0.40.0 <1.0.0", - "@azure-tools/typespec-azure-resource-manager": ">=0.40.0 <1.0.0", - "@azure-tools/typespec-autorest": ">=0.40.0 <1.0.0", - "@azure-tools/typespec-client-generator-core": ">=0.40.0 <1.0.0", - "@typespec/compiler": ">=0.54.0 <1.0.0", - "@typespec/http": ">=0.54.0 <1.0.0", - "@typespec/rest": ">=0.54.0 <1.0.0", - "@typespec/versioning": ">=0.54.0 <1.0.0", - "@typespec/openapi": ">=0.54.0 <1.0.0" - }, - "dependenciesMeta": { - "@azure-tools/typespec-client-generator-core": { - "injected": true - } - }, - "dependencies": { - "@autorest/python": "workspace:^", - "js-yaml": "~4.1.0", - "@typespec/openapi3": "latest" - }, - "devDependencies": { - "@azure-tools/typespec-azure-resource-manager": "~0.40.0", - "@azure-tools/typespec-autorest": "~0.40.0", - "@azure-tools/cadl-ranch-expect": "~0.13.1", - "@azure-tools/cadl-ranch-specs": "~0.31.0", - "@types/js-yaml": "~4.0.5", - "@types/mocha": "~10.0.1", - "@types/node": "^18.16.3", - "@typespec/eslint-config-typespec": "~0.54.0", - "@typespec/openapi": "~0.54.0", - "c8": "~7.13.0", - "eslint": "^8.44.0", - "mocha": "~10.2.0", - "rimraf": "~5.0.0", - "typescript": "~5.1.3", - "@azure-tools/typespec-azure-core": "~0.40.0", - "@azure-tools/typespec-client-generator-core": "~0.40.0", - "@typespec/compiler": "~0.54.0", - "@typespec/http": "~0.54.0", - "@typespec/rest": "~0.54.0", - "@typespec/versioning": "~0.54.0" + "name": "@azure-tools/typespec-python", + "version": "0.23.0", + "author": "Microsoft Corporation", + "description": "TypeSpec emitter for Python SDKs", + "homepage": "https://github.com/Azure/autorest.python", + "readme": "https://github.com/Azure/autorest.python/packages/typespec-python/README.md", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/autorest.python.git" + }, + "bugs": { + "url": "https://github.com/Azure/autorest.python/issues" + }, + "keywords": [ + "typespec" + ], + "type": "module", + "main": "dist/src/index.js", + "exports": { + ".": "./dist/src/index.js", + "./testing": "./dist/src/testing/index.js" + }, + "tspMain": "dist/src/index.js", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "clean": "rimraf ./dist ./temp", + "build": "tsc -p .", + "watch": "tsc -p . --watch", + "test": "mocha", + "test-official": "c8 mocha --forbid-only", + "lint": "eslint . --ext .ts --max-warnings=0", + "lint:fix": "eslint . --fix --ext .ts" + }, + "files": [ + "lib/*.cadl", + "dist/**", + "!dist/test/**", + "get-autorest-python-path.cjs" + ], + "peerDependencies": { + "@azure-tools/typespec-azure-core": ">=0.41.0 <1.0.0", + "@azure-tools/typespec-azure-resource-manager": ">=0.41.0 <1.0.0", + "@azure-tools/typespec-autorest": ">=0.41.0 <1.0.0", + "@azure-tools/typespec-client-generator-core": ">=0.41.1 <1.0.0", + "@typespec/compiler": ">=0.55.0 <1.0.0", + "@typespec/http": ">=0.55.0 <1.0.0", + "@typespec/rest": ">=0.55.0 <1.0.0", + "@typespec/versioning": ">=0.55.0 <1.0.0", + "@typespec/openapi": ">=0.55.0 <1.0.0" + }, + "dependenciesMeta": { + "@azure-tools/typespec-client-generator-core": { + "injected": true } + }, + "dependencies": { + "@autorest/python": "workspace:^", + "js-yaml": "~4.1.0", + "@typespec/openapi3": "latest" + }, + "devDependencies": { + "@azure-tools/typespec-azure-resource-manager": "~0.41.0", + "@azure-tools/typespec-autorest": "~0.41.0", + "@azure-tools/cadl-ranch-expect": "~0.13.1", + "@azure-tools/cadl-ranch-specs": "~0.31.6", + "@types/js-yaml": "~4.0.5", + "@types/mocha": "~10.0.1", + "@types/node": "^18.16.3", + "@typespec/eslint-config-typespec": "~0.55.0", + "@typespec/openapi": "~0.55.0", + "c8": "~7.13.0", + "eslint": "^8.44.0", + "mocha": "~10.2.0", + "rimraf": "~5.0.0", + "typescript": "~5.1.3", + "@azure-tools/typespec-azure-core": "~0.41.0", + "@azure-tools/typespec-client-generator-core": "~0.41.1", + "@typespec/compiler": "~0.55.0", + "@typespec/http": "~0.55.0", + "@typespec/rest": "~0.55.0", + "@typespec/versioning": "~0.55.0" + } } diff --git a/packages/typespec-python/src/code-model.ts b/packages/typespec-python/src/code-model.ts new file mode 100644 index 00000000000..6b230698c74 --- /dev/null +++ b/packages/typespec-python/src/code-model.ts @@ -0,0 +1,266 @@ +import { + SdkBasicServiceMethod, + SdkClientType, + SdkCredentialParameter, + SdkEndpointParameter, + SdkLroPagingServiceMethod, + SdkLroServiceMethod, + SdkMethodParameter, + SdkPagingServiceMethod, + SdkServiceMethod, + SdkServiceOperation, + UsageFlags, + getCrossLanguagePackageId, +} from "@azure-tools/typespec-client-generator-core"; +import { KnownTypes, getType, simpleTypesMap, typesMap } from "./types.js"; +import { emitParamBase, getImplementation, removeUnderscoresFromNamespace } from "./utils.js"; +import { emitBasicHttpMethod, emitLroHttpMethod, emitLroPagingHttpMethod, emitPagingHttpMethod } from "./http.js"; +import { PythonSdkContext } from "./lib.js"; +import { ignoreDiagnostics } from "@typespec/compiler"; + +function emitBasicMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkBasicServiceMethod, + operationGroupName: string, +): Record[] { + if (method.operation.kind !== "http") throw new Error("We only support HTTP operations right now"); + switch (method.operation.kind) { + case "http": + return emitBasicHttpMethod(context, rootClient, method, operationGroupName); + default: + throw new Error("We only support HTTP operations right now"); + } +} + +function emitLroMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkLroServiceMethod, + operationGroupName: string, +): Record[] { + if (method.operation.kind !== "http") throw new Error("We only support HTTP operations right now"); + switch (method.operation.kind) { + case "http": + return emitLroHttpMethod(context, rootClient, method, operationGroupName); + default: + throw new Error("We only support HTTP operations right now"); + } +} + +function emitPagingMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkPagingServiceMethod, + operationGroupName: string, +): Record[] { + if (method.operation.kind !== "http") throw new Error("We only support HTTP operations right now"); + switch (method.operation.kind) { + case "http": + return emitPagingHttpMethod(context, rootClient, method, operationGroupName); + default: + throw new Error("We only support HTTP operations right now"); + } +} + +function emitLroPagingMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkLroPagingServiceMethod, + operationGroupName: string, +): Record[] { + if (method.operation.kind !== "http") throw new Error("We only support HTTP operations right now"); + switch (method.operation.kind) { + case "http": + return emitLroPagingHttpMethod(context, rootClient, method, operationGroupName); + default: + throw new Error("We only support HTTP operations right now"); + } +} + +function emitMethodParameter( + context: PythonSdkContext, + client: SdkClientType, + parameter: SdkEndpointParameter | SdkCredentialParameter | SdkMethodParameter, +): Record[] { + if (parameter.kind === "endpoint") { + if (parameter.type.serverUrl && parameter.type.templateArguments.length > 0) { + const params: Record[] = []; + for (const param of parameter.type.templateArguments) { + params.push({ + ...emitParamBase(context, param), + wireName: param.name, + location: "endpointPath", + implementation: getImplementation(context, param), + clientDefaultValue: param.clientDefaultValue, + skipUrlEncoding: param.urlEncode === false, + }); + context.__endpointPathParameters!.push(params.at(-1)!); + } + return params; + } else { + return [ + { + optional: parameter.optional, + description: parameter.description || "", + clientName: context.arm ? "base_url" : "endpoint", + clientDefaultValue: parameter.type.serverUrl, + wireName: "$host", + location: "path", + type: KnownTypes.string, + implementation: getImplementation(context, parameter), + inOverload: false, + }, + ]; + } + } + const base = { + ...emitParamBase(context, parameter), + implementation: getImplementation(context, parameter), + clientDefaultValue: parameter.clientDefaultValue, + location: parameter.kind, + }; + if (parameter.isApiVersionParam) { + return [ + { + ...base, + location: "query", + wireName: "api-version", + in_docstring: false, + }, + ]; + } + return [base]; +} + +function emitMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkServiceMethod, + operationGroupName: string, +): Record[] { + switch (method.kind) { + case "basic": + return emitBasicMethod(context, rootClient, method, operationGroupName); + case "lro": + return emitLroMethod(context, rootClient, method, operationGroupName); + case "paging": + return emitPagingMethod(context, rootClient, method, operationGroupName); + default: + return emitLroPagingMethod(context, rootClient, method, operationGroupName); + } +} + +function emitOperationGroups( + context: PythonSdkContext, + client: SdkClientType, + rootClient: SdkClientType, + prefix: string, +): Record[] | undefined { + const operationGroups: Record[] = []; + + for (const method of client.methods) { + if (method.kind === "clientaccessor") { + const operationGroup = method.response; + const name = `${prefix}${operationGroup.name}`; + let operations: Record[] = []; + for (const method of operationGroup.methods) { + if (method.kind === "clientaccessor") continue; + operations = operations.concat(emitMethod(context, rootClient, method, name)); + } + operationGroups.push({ + name: name, + className: name, + propertyName: operationGroup.name, + operations: operations, + operationGroups: emitOperationGroups(context, operationGroup, rootClient, name), + }); + } + } + + // root client should deal with mixin operation group + if (prefix === "") { + let operations: Record[] = []; + for (const method of client.methods) { + if (method.kind === "clientaccessor") continue; + operations = operations.concat(emitMethod(context, rootClient, method, "")); + } + if (operations.length > 0) { + operationGroups.push({ + name: "", + className: "", + propertyName: "", + operations: operations, + }); + } + } + + return operationGroups.length > 0 ? operationGroups : undefined; +} + +function emitClient( + context: PythonSdkContext, + client: SdkClientType, +): Record { + if (client.initialization) { + context.__endpointPathParameters = []; + } + const parameters = + client.initialization?.properties + .map((x) => emitMethodParameter(context, client, x)) + .reduce((a, b) => [...a, ...b]) ?? []; + + const endpointParameter = client.initialization?.properties.find((x) => x.kind === "endpoint") as + | SdkEndpointParameter + | undefined; + const operationGroups = emitOperationGroups(context, client, client, ""); + if (context.__subscriptionIdPathParameter) { + parameters.push(context.__subscriptionIdPathParameter); + } + return { + name: client.name, + description: client.description ?? "", + parameters, + operationGroups, + url: endpointParameter?.type.serverUrl, + apiVersions: client.apiVersions, + arm: context.arm, + }; +} + +export function emitCodeModel( + sdkContext: PythonSdkContext, +) { + // Get types + const sdkPackage = sdkContext.experimental_sdkPackage; + const codeModel: Record = { + namespace: removeUnderscoresFromNamespace(sdkPackage.rootNamespace).toLowerCase(), + clients: [], + subnamespaceToClients: {}, + }; + for (const model of sdkPackage.models) { + if (model.name === "") { + continue; + } + getType(sdkContext, model); + } + for (const sdkEnum of sdkPackage.enums) { + if (sdkEnum.usage === UsageFlags.ApiVersionEnum) { + continue; + } + getType(sdkContext, sdkEnum); + } + for (const client of sdkPackage.clients) { + if (client.initialization.access === "public") { + // right now to keep python changes minimal, we're just supporting top level clients + codeModel["clients"].push(emitClient(sdkContext, client)); + } + if (client.nameSpace === sdkPackage.rootNamespace) { + } else { + codeModel["subnamespaceToClients"][client.nameSpace] = emitClient(sdkContext, client); + } + } + codeModel["types"] = [...typesMap.values(), ...Object.values(KnownTypes), ...simpleTypesMap.values()]; + codeModel["crossLanguagePackageId"] = ignoreDiagnostics(getCrossLanguagePackageId(sdkContext)); + return codeModel; +} diff --git a/packages/typespec-python/src/emitter.ts b/packages/typespec-python/src/emitter.ts index bc0cf7a4932..42d4cd9534f 100644 --- a/packages/typespec-python/src/emitter.ts +++ b/packages/typespec-python/src/emitter.ts @@ -1,70 +1,17 @@ -import { getPagedResult, getLroMetadata } from "@azure-tools/typespec-azure-core"; +import { EmitContext } from "@typespec/compiler"; import { - getDoc, - getSummary, - ignoreDiagnostics, - ModelProperty, - Namespace, - Operation, - EmitContext, - listServices, - Type, - getNamespaceFullName, -} from "@typespec/compiler"; -import { - getAuthentication, - getHttpOperation, - getServers, - HttpOperationParameter, - HttpOperationResponse, - HttpServer, - HttpOperation, - HttpStatusCodeRange, -} from "@typespec/http"; -import { getAddedOnVersions } from "@typespec/versioning"; -import { - SdkClient, - listClients, - listOperationGroups, - listOperationsInOperationGroup, - isApiVersion, - getDefaultApiVersion, - getClientNamespaceString, createSdkContext, SdkContext, - getLibraryName, - getAllModels, - isInternal, - getPropertyNames, - getEffectivePayloadType, - getAccess, - SdkOperationGroup, - isErrorOrChildOfError, - getCrossLanguagePackageId, - getCrossLanguageDefinitionId, + SdkHttpOperation, + SdkServiceOperation, } from "@azure-tools/typespec-client-generator-core"; -import { getResourceOperation } from "@typespec/rest"; import { resolveModuleRoot, saveCodeModelAsYaml } from "./external-process.js"; import { dirname } from "path"; import { fileURLToPath } from "url"; import { execFileSync } from "child_process"; -import { PythonEmitterOptions } from "./lib.js"; -import { camelToSnakeCase, removeUnderscoresFromNamespace } from "./utils.js"; -import { - CredentialType, - CredentialTypeUnion, - getConstantType, - getType, - KnownTypes, - simpleTypesMap, - typesMap, -} from "./types.js"; - -interface HttpServerParameter { - type: "endpointPath"; - name: string; - param: ModelProperty; -} +import { PythonEmitterOptions, PythonSdkContext } from "./lib.js"; +import { emitCodeModel } from "./code-model.js"; +import { removeUnderscoresFromNamespace } from "./utils.js"; export function getModelsMode(context: SdkContext): "dpg" | "none" { const specifiedModelsMode = context.emitContext.options["models-mode"]; @@ -94,7 +41,9 @@ function addDefaultOptions(sdkContext: SdkContext) { options["package-mode"] = sdkContext.arm ? "azure-mgmt" : "azure-dataplane"; } if (!options["package-name"]) { - options["package-name"] = getClientNamespaceStringHelper(sdkContext).replace(/\./g, "-"); + options["package-name"] = removeUnderscoresFromNamespace( + sdkContext.experimental_sdkPackage.rootNamespace.toLowerCase(), + ).replace(/\./g, "-"); } if (options.flavor !== "azure") { // if they pass in a flavor other than azure, we want to ignore the value @@ -104,14 +53,24 @@ function addDefaultOptions(sdkContext: SdkContext) { options.flavor = "azure"; } } + +function createPythonSdkContext( + context: EmitContext, +): PythonSdkContext { + return { + ...createSdkContext(context, "@azure-tools/typespec-python"), + __endpointPathParameters: [], + __subscriptionIdPathParameter: undefined, + }; +} + export async function $onEmit(context: EmitContext) { const program = context.program; - const sdkContext = createSdkContext(context, "@azure-tools/typespec-python"); - const clients = listClients(sdkContext); - addDefaultOptions(sdkContext); + const sdkContext = createPythonSdkContext(context); const root = await resolveModuleRoot(program, "@autorest/python", dirname(fileURLToPath(import.meta.url))); const outputDir = context.emitterOutputDir; - const yamlMap = emitCodeModel(sdkContext, clients); + const yamlMap = emitCodeModel(sdkContext); + addDefaultOptions(sdkContext); const yamlPath = await saveCodeModelAsYaml("typespec-python-yaml-map", yamlMap); const commandArgs = [ `${root}/run-python3.js`, @@ -145,846 +104,3 @@ export async function $onEmit(context: EmitContext) { execFileSync(process.execPath, commandArgs); } } - -const endpointPathParameters: Record[] = []; -let apiVersionParam: Record | undefined = undefined; -let subscriptionIdParam: Record | undefined = undefined; - -function getDocStr(context: SdkContext, target: Type): string { - return getDoc(context.program, target) ?? ""; -} - -// To pass the yaml dump -function getAddedOnVersion(context: SdkContext, t: Type): string | undefined { - const versions = getAddedOnVersions(context.program as any, t as any); - if (versions !== undefined && versions.length > 0) { - return versions[0].value; - } - return undefined; -} - -type ParamBase = { - optional: boolean; - description: string; - addedOn: string | undefined; - clientName: string; - inOverload: boolean; -}; - -function emitParamBase(context: SdkContext, parameter: ModelProperty | Type): ParamBase { - let optional: boolean; - let name: string; - let description: string = ""; - let addedOn: string | undefined; - - if (parameter.kind === "ModelProperty") { - optional = parameter.optional; - name = getLibraryName(context, parameter); - description = getDocStr(context, parameter); - addedOn = getAddedOnVersion(context, parameter); - } else { - optional = false; - name = "body"; - } - - return { - optional, - description, - addedOn, - clientName: camelToSnakeCase(name), - inOverload: false, - }; -} - -type BodyParameter = ParamBase & { - contentTypes: string[]; - type: any; - wireName: string; - location: "body"; - defaultContentType: string; -}; - -function getBodyType(context: SdkContext, route: HttpOperation): Record { - let bodyModel = route.parameters.body?.type; - if (bodyModel && bodyModel.kind === "Model" && route.operation) { - const resourceType = getResourceOperation(context.program, route.operation)?.resourceType; - if (resourceType && route.responses && route.responses.length > 0) { - const resp = route.responses[0]; - if (resp && resp.responses && resp.responses.length > 0) { - const responseBody = resp.responses[0]?.body; - if (responseBody?.type?.kind === "Model") { - const bodyTypeInResponse = getEffectivePayloadType(context, responseBody.type); - // response body type is reosurce type, and request body type (if templated) contains resource type - if ( - bodyTypeInResponse === resourceType && - bodyModel.templateMapper && - bodyModel.templateMapper.args.some((it) => { - return it.kind === "Model" || it.kind === "Union" ? it === bodyTypeInResponse : false; - }) - ) { - bodyModel = resourceType; - } - } - } - } - if (resourceType && bodyModel.name === "") { - const effectivePayloadType = getEffectivePayloadType(context, bodyModel); - if (effectivePayloadType.name !== "") { - bodyModel = effectivePayloadType; - } else { - bodyModel = resourceType; - } - } - } - if (bodyModel && bodyModel.kind === "Scalar") { - return getType(context, route.parameters.body!.parameter!, true); - } - return getType(context, bodyModel!, true); -} - -function emitBodyParameter(context: SdkContext, httpOperation: HttpOperation): BodyParameter { - const params = httpOperation.parameters; - const body = params.body!; - const base = emitParamBase(context, body.parameter ?? body.type); - let contentTypes = body.contentTypes; - if (contentTypes.length === 0) { - contentTypes = ["application/json"]; - } - const type = getBodyType(context, httpOperation); - - if (type.type === "model" && type.name === "") { - type.name = capitalize(httpOperation.operation.name) + "Request"; - } - - return { - contentTypes, - type, - wireName: body.parameter?.name ?? "body", - location: "body", - ...base, - defaultContentType: - body.parameter?.default ?? contentTypes.includes("application/json") ? "application/json" : contentTypes[0], - }; -} - -function isSubscriptionId(context: SdkContext, param: Record): boolean { - return Boolean(context.arm) && param.wireName === "subscriptionId"; -} - -function getDefaultApiVersionValue(context: SdkContext): string | undefined { - const defaultApiVersion = getDefaultApiVersion(context, getServiceNamespace(context)); - if (!defaultApiVersion) { - if (context.arm) { - const services = listServices(context.program); - // eslint-disable-next-line deprecation/deprecation - return services.length > 0 ? services[0].version : undefined; - } - return defaultApiVersion; - } - return defaultApiVersion.value; -} - -function emitParameter( - context: SdkContext, - parameter: HttpOperationParameter | HttpServerParameter, - implementation: string, -): Record { - const base = emitParamBase(context, parameter.param); - base.clientName = camelToSnakeCase(getPropertyNames(context, parameter.param)[0]); - let type = getType(context, parameter.param); - let clientDefaultValue = undefined; - if (parameter.name.toLowerCase() === "content-type" && type["type"] === "constant") { - /// We don't want constant types for content types, so we make sure if it's - /// a constant, we make it not constant - clientDefaultValue = type["value"]; - type = type["valueType"]; - } - const paramMap: Record = { - wireName: parameter.type === "path" ? parameter.param.name : parameter.name, - location: parameter.type, - type: type, - implementation: implementation, - skipUrlEncoding: parameter.type === "endpointPath", - }; - if (type.type === "list" && (parameter.type === "query" || parameter.type === "header")) { - if (parameter.format === "csv") { - paramMap["delimiter"] = "comma"; - } else if ((parameter.format as string) === "ssv") { - paramMap["delimiter"] = "space"; - } else if ((parameter.format as string) === "tsv") { - paramMap["delimiter"] = "tab"; - } else if ((parameter.format as string) === "pipes") { - paramMap["delimiter"] = "pipe"; - } else { - paramMap["explode"] = true; - } - } - - if (paramMap.type.type === "constant") { - clientDefaultValue = paramMap.type.value; - } - - if (isApiVersion(context, parameter as HttpOperationParameter)) { - const defaultApiVersion = getDefaultApiVersionValue(context); - paramMap.type = defaultApiVersion ? getConstantType(defaultApiVersion) : KnownTypes.string; - paramMap.implementation = "Client"; - paramMap.in_docstring = false; - paramMap.isApiVersion = true; - if (defaultApiVersion) { - clientDefaultValue = defaultApiVersion; - } - } - if (isSubscriptionId(context, paramMap)) { - paramMap.implementation = "Client"; - } - return { clientDefaultValue, ...base, ...paramMap }; -} - -function emitContentTypeParameter( - bodyParameter: Record, - inOverload: boolean, - inOverriden: boolean, -): Record { - return { - checkClientInput: false, - clientDefaultValue: bodyParameter.defaultContentType, - clientName: "content_type", - delimiter: null, - description: `Body parameter Content-Type. Known values are: ${bodyParameter.contentTypes}.`, - implementation: "Method", - inDocstring: true, - inOverload: inOverload, - inOverriden: inOverriden, - location: "header", - optional: true, - wireName: "Content-Type", - type: KnownTypes.string, - }; -} - -function emitFlattenedParameter( - bodyParameter: Record, - property: Record, -): Record { - return { - checkClientInput: false, - clientDefaultValue: null, - clientName: property.clientName, - delimiter: null, - description: property.description, - implementation: "Method", - inDocstring: true, - inFlattenedBody: true, - inOverload: false, - inOverriden: false, - isApiVersion: bodyParameter["isApiVersion"], - location: "other", - optional: property["optional"], - wireName: null, - skipUrlEncoding: false, - type: property["type"], - defaultToUnsetSentinel: true, - }; -} - -function emitAcceptParameter(inOverload: boolean, inOverriden: boolean, contentType: string): Record { - return { - checkClientInput: false, - clientDefaultValue: contentType, - clientName: "accept", - delimiter: null, - description: "Accept header.", - explode: false, - groupedBy: null, - implementation: "Method", - inDocstring: true, - inOverload: inOverload, - inOverriden: inOverriden, - location: "header", - optional: false, - wireName: "Accept", - skipUrlEncoding: false, - type: getConstantType(contentType), - }; -} - -function emitResponseHeaders(context: SdkContext, response: HttpOperationResponse): Record[] { - const headers: Record[] = []; - for (const innerResponse of response.responses) { - if (innerResponse.headers && Object.keys(innerResponse.headers).length > 0) { - for (const [key, value] of Object.entries(innerResponse.headers)) { - headers.push({ - type: getType(context, value), - wireName: key, - }); - } - } - } - return headers; -} - -function isAzureCoreModel(t: Type): boolean { - return ( - t.kind === "Model" && - t.namespace !== undefined && - ["Azure.Core", "Azure.Core.Foundations"].includes(getNamespaceFullName(t.namespace)) - ); -} - -function getBodyFromResponse(context: SdkContext, response: HttpOperationResponse): Type | undefined { - let body: Type | undefined = undefined; - for (const innerResponse of response.responses) { - if (!body && innerResponse.body) { - body = innerResponse.body.type; - } - } - if (body && body.kind === "Model") { - body = getEffectivePayloadType(context, body); - } - return body; -} - -function isHttpStatusCode(statusCodes: any): statusCodes is HttpStatusCodeRange { - if (typeof statusCodes !== "object") { - return false; - } - return "start" in statusCodes; -} - -function getContentTypesFromResponse(context: SdkContext, response: HttpOperationResponse): string[] { - let contentTypes: string[] = []; - for (const innerResponse of response.responses) { - if (innerResponse.body) { - contentTypes = contentTypes.concat(innerResponse.body.contentTypes); - } - } - return contentTypes; -} - -function emitResponse(context: SdkContext, response: HttpOperationResponse): Record { - let type = undefined; - const body = getBodyFromResponse(context, response); - if (body) { - if (body.kind === "Model") { - if (body && body.decorators.find((d) => d.decorator.name === "$pagedResult")) { - type = getType(context, Array.from(body.properties.values())[0]); - } else if (body && !isAzureCoreModel(body)) { - type = getType(context, body); - } - } else { - type = getType(context, body); - } - } - const statusCodes: ("default" | number)[] = []; - if (response.statusCodes === "*") { - statusCodes.push("default"); - } else if (isHttpStatusCode(response.statusCodes)) { - statusCodes.push(response.statusCodes.start); - } else { - statusCodes.push(response.statusCodes); - } - - const contentTypes = getContentTypesFromResponse(context, response); - return { - headers: emitResponseHeaders(context, response), - statusCodes: statusCodes, - addedOn: getAddedOnVersion(context, response.type), - discriminator: "basic", - type: type, - contentTypes: contentTypes, - defaultContentType: - contentTypes.length > 0 && !contentTypes.includes("application/json") - ? contentTypes[0] - : "application/json", - }; -} - -function emitOperation(context: SdkContext, operation: Operation, operationGroupName: string): Record[] { - const lro = getLroMetadata(context.program, operation); - const paging = getPagedResult(context.program, operation); - if (lro && paging) { - return emitLroPagingOperation(context, operation, operationGroupName); - } else if (paging) { - return emitPagingOperation(context, operation, operationGroupName); - } else if (lro) { - return emitLroOperation(context, operation, operationGroupName); - } - return emitBasicOperation(context, operation, operationGroupName); -} - -function addLroInformation( - context: SdkContext, - tspOperation: Operation, - emittedOperation: Record, - initialOperation: Record, -) { - emittedOperation["discriminator"] = "lro"; - emittedOperation["initialOperation"] = initialOperation; - emittedOperation["exposeStreamKeyword"] = false; - const lroMeta = getLroMetadata(context.program, tspOperation); - let logicalResult = lroMeta!.logicalResult; - if (logicalResult.name === "") { - logicalResult = getEffectivePayloadType(context, logicalResult); - } - if (!isAzureCoreModel(logicalResult)) { - emittedOperation["responses"][0]["type"] = getType(context, logicalResult); - if (lroMeta!.logicalPath) { - emittedOperation["responses"][0]["resultProperty"] = lroMeta!.logicalPath; - } - addAcceptParameter(context, tspOperation, emittedOperation["parameters"]); - addAcceptParameter(context, lroMeta!.operation, emittedOperation["initialOperation"]["parameters"]); - } -} -function addPagingInformation(context: SdkContext, operation: Operation, emittedOperation: Record) { - emittedOperation["discriminator"] = "paging"; - const pagedResult = getPagedResult(context.program, operation); - if (pagedResult === undefined) { - throw Error("Trying to add paging information, but not paging metadata for this operation"); - } - if (!isAzureCoreModel(pagedResult.modelType)) { - getType(context, pagedResult.modelType)["pageResultModel"] = true; - } - emittedOperation["itemName"] = pagedResult.itemsSegments ? pagedResult.itemsSegments.join(".") : null; - emittedOperation["itemType"] = getType(context, pagedResult.itemsProperty!.type); - emittedOperation["continuationTokenName"] = pagedResult.nextLinkSegments - ? pagedResult.nextLinkSegments.join(".") - : null; - emittedOperation["exposeStreamKeyword"] = false; -} - -function getLroInitialOperation( - context: SdkContext, - operation: Operation, - operationGroupName: string, -): Record { - const initialTspOperation = getLroMetadata(context.program, operation)!.operation; - const initialOperation = emitBasicOperation(context, initialTspOperation, operationGroupName)[0]; - initialOperation["name"] = `_${initialOperation["name"]}_initial`; - initialOperation["isLroInitialOperation"] = true; - initialOperation["wantTracing"] = false; - initialOperation["exposeStreamKeyword"] = false; - initialOperation["responses"].forEach((resp: Record, index: number) => { - if ( - getBodyFromResponse( - context, - ignoreDiagnostics(getHttpOperation(context.program, initialTspOperation)).responses[index], - ) - ) { - // if there's a body, even if it's an Azure.Core model, we want to use anyObject - resp["type"] = KnownTypes.anyObject; - } - }); - return initialOperation; -} - -function emitLroPagingOperation( - context: SdkContext, - operation: Operation, - operationGroupName: string, -): Record[] { - const retval: Record[] = []; - for (const emittedOperation of emitBasicOperation(context, operation, operationGroupName)) { - const initialOperation = getLroInitialOperation(context, operation, operationGroupName); - addLroInformation(context, operation, emittedOperation, initialOperation); - addPagingInformation(context, operation, emittedOperation); - emittedOperation["discriminator"] = "lropaging"; - retval.push(emittedOperation); - } - return retval; -} - -function emitLroOperation( - context: SdkContext, - operation: Operation, - operationGroupName: string, -): Record[] { - const retval = []; - for (const emittedOperation of emitBasicOperation(context, operation, operationGroupName)) { - const initialOperation = getLroInitialOperation(context, operation, operationGroupName); - addLroInformation(context, operation, emittedOperation, initialOperation); - retval.push(initialOperation); - retval.push(emittedOperation); - } - return retval; -} - -function emitPagingOperation( - context: SdkContext, - operation: Operation, - operationGroupName: string, -): Record[] { - const retval = []; - for (const emittedOperation of emitBasicOperation(context, operation, operationGroupName)) { - addPagingInformation(context, operation, emittedOperation); - retval.push(emittedOperation); - } - return retval; -} - -function isAbstract(operation: HttpOperation): boolean { - const body = operation.parameters.body; - const multipleContentTypes = body !== undefined && body.contentTypes.length > 1; - if (!multipleContentTypes) return false; - return body.contentTypes.some((x) => x.includes("json")); -} - -function addAcceptParameter( - context: SdkContext, - operation: Operation, - parameters: Record[], - contentType: string = "application/json", -) { - const httpOperation = ignoreDiagnostics(getHttpOperation(context.program, operation)); - if ( - getBodyFromResponse(context, httpOperation.responses[0]) && - parameters.filter((e) => e.wireName.toLowerCase() === "accept").length === 0 - ) { - parameters.push(emitAcceptParameter(false, false, contentType)); - } -} - -function emitBasicOperation( - context: SdkContext, - operation: Operation, - operationGroupName: string, -): Record[] { - // Set up parameters for operation - const parameters: Record[] = []; - if (endpointPathParameters) { - for (const param of endpointPathParameters) { - parameters.push(param); - } - } - const httpOperation = ignoreDiagnostics(getHttpOperation(context.program, operation)); - for (const param of httpOperation.parameters.parameters) { - const emittedParam = emitParameter(context, param, "Method"); - if (isApiVersion(context, param) && apiVersionParam === undefined) { - apiVersionParam = emittedParam; - } - if (isSubscriptionId(context, emittedParam) && subscriptionIdParam === undefined) { - subscriptionIdParam = emittedParam; - } - parameters.push(emittedParam); - } - - // Set up responses for operation - const responses: Record[] = []; - const exceptions: Record[] = []; - const isOverload: boolean = false; - const isOverriden: boolean = false; - for (const response of httpOperation.responses) { - const emittedResponse = emitResponse(context, response); - addAcceptParameter(context, operation, parameters, emittedResponse.defaultContentType); - if (response.type && response.type.kind === "Model" && isErrorOrChildOfError(context, response.type)) { - // * is valid status code in cadl but invalid for autorest.python - if (response.statusCodes === "*") { - exceptions.push(emittedResponse); - } - } else { - responses.push(emittedResponse); - } - } - - let bodyParameter: Record | undefined; - if (httpOperation.parameters.body === undefined) { - bodyParameter = undefined; - } else { - bodyParameter = emitBodyParameter(context, httpOperation); - if (parameters.filter((e) => e.wireName.toLowerCase() === "content-type").length === 0) { - parameters.push(emitContentTypeParameter(bodyParameter, isOverload, isOverriden)); - } - if (bodyParameter.type.type === "model" && bodyParameter.type.base === "json") { - bodyParameter["propertyToParameterName"] = {}; - if (!isOverload) { - bodyParameter.defaultToUnsetSentinel = true; - } - for (const property of bodyParameter.type.properties) { - bodyParameter["propertyToParameterName"][property["wireName"]] = property["clientName"]; - parameters.push(emitFlattenedParameter(bodyParameter, property)); - } - } - } - const name = camelToSnakeCase(getLibraryName(context, operation)); - return [ - { - name: name, - description: getDocStr(context, operation), - summary: getSummary(context.program, operation), - url: httpOperation.path, - method: httpOperation.verb.toUpperCase(), - parameters: parameters, - bodyParameter: bodyParameter, - responses: responses, - exceptions: exceptions, - groupName: operationGroupName, - addedOn: getAddedOnVersion(context, operation), - discriminator: "basic", - isOverload: false, - overloads: [], - apiVersions: [getAddedOnVersion(context, operation)], - wantTracing: true, - exposeStreamKeyword: true, - abstract: isAbstract(httpOperation), - internal: isInternal(context, operation) || getAccess(context, operation) === "internal", // eslint-disable-line deprecation/deprecation - crossLanguageDefinitionId: getCrossLanguageDefinitionId(operation), - }, - ]; -} - -function capitalize(name: string): string { - return name[0].toUpperCase() + name.slice(1); -} - -function emitOperationGroups( - context: SdkContext, - group: SdkClient | SdkOperationGroup, -): Record[] | undefined { - const operationGroups: Record[] = []; - - if (group.kind === "SdkClient") { - for (const operationGroup of listOperationGroups(context, group)) { - const name = operationGroup.type.name; - operationGroups.push({ - name: name, - className: name, - propertyName: name, - operations: listOperationsInOperationGroup(context, operationGroup) - .map((o) => emitOperation(context, o, name)) - .reduce((a, b) => a.concat(...b), []), - operationGroups: emitOperationGroups(context, operationGroup), - }); - } - - // mixin operation group - const operations = listOperationsInOperationGroup(context, group); - if (operations.length > 0) { - operationGroups.push({ - name: "", - className: "", - propertyName: "", - operations: listOperationsInOperationGroup(context, group) - .map((o) => emitOperation(context, o, "")) - .reduce((a, b) => a.concat(b), []), - }); - } - } else { - if (group.subOperationGroups === undefined) { - return undefined; - } - for (const operationGroup of group.subOperationGroups) { - const name = operationGroup.groupPath.split(".").slice(1).join(""); - operationGroups.push({ - name: name, - className: name, - propertyName: operationGroup.type.name, // property name do not need to add prefix to avoid naming collision - operations: listOperationsInOperationGroup(context, operationGroup) - .map((o) => emitOperation(context, o, name)) - .reduce((a, b) => a.concat(...b), []), - operationGroups: emitOperationGroups(context, operationGroup), - }); - } - } - - return operationGroups; -} - -function getServerHelper(context: SdkContext, namespace: Namespace): HttpServer | undefined { - const servers = getServers(context.program, namespace); - if (servers === undefined) { - return undefined; - } - return servers[0]; -} - -function hostParam(clientName: string = "endpoint", clientDefaultValue: string | null = null): Record { - return { - optional: false, - description: "Service host", - clientName: clientName, - clientDefaultValue: clientDefaultValue, - wireName: "$host", - location: "path", - type: KnownTypes.string, - implementation: "Client", - inOverload: false, - }; -} - -function emitServerParams(context: SdkContext, namespace: Namespace): Record[] { - const server = getServerHelper(context, namespace); - if (server === undefined) { - return [hostParam()]; - } - if (server.parameters.size > 0) { - const params: Record[] = []; - for (const param of server.parameters.values()) { - const serverParameter: HttpServerParameter = { - type: "endpointPath", - name: param.name, - param: param, - }; - const emittedParameter = emitParameter(context, serverParameter, "Client"); - if (!endpointPathParameters.some((p) => p.clientName === emittedParameter.clientName)) { - endpointPathParameters.push(emittedParameter); - } - if (isApiVersion(context, serverParameter as any) && apiVersionParam === undefined) { - apiVersionParam = emittedParameter; - continue; - } - params.push(emittedParameter); - } - return params; - } else { - return [hostParam(context.arm ? "base_url" : "endpoint", server.url)]; - } -} - -function emitCredentialParam(context: SdkContext, namespace: Namespace): Record | undefined { - const auth = getAuthentication(context.program, namespace); - if (auth) { - const credential_types: CredentialType[] = []; - for (const option of auth.options) { - for (const scheme of option.schemes) { - const type: CredentialType = { - kind: "Credential", - scheme: scheme, - }; - credential_types.push(type); - } - } - if (credential_types.length > 0) { - let type: CredentialType | CredentialTypeUnion; - if (credential_types.length === 1) { - type = credential_types[0]; - } else { - type = { - kind: "CredentialTypeUnion", - types: credential_types, - }; - } - const service = context.emitContext.options.flavor ? "Azure" : "cloud service"; - return { - type: getType(context, type), - optional: false, - description: `Credential needed for the client to connect to ${service}.`, - clientName: "credential", - location: "other", - wireName: "credential", - implementation: "Client", - skipUrlEncoding: true, - inOverload: false, - }; - } - } - return undefined; -} - -function emitGlobalParameters(context: SdkContext, namespace: Namespace): Record[] { - const clientParameters = emitServerParams(context, namespace); - const credentialParam = emitCredentialParam(context, namespace); - if (credentialParam) { - clientParameters.push(credentialParam); - } - - return clientParameters; -} - -function getApiVersionParameter(context: SdkContext): Record | void { - const version = getDefaultApiVersionValue(context); - if (apiVersionParam) { - return apiVersionParam; - } else if (version !== undefined) { - return { - clientName: "api_version", - clientDefaultValue: version, - description: "Api Version", - implementation: "Client", - location: "query", - wireName: "api-version", - skipUrlEncoding: false, - optional: false, - inDocString: true, - inOverload: false, - inOverridden: false, - type: getConstantType(version), - isApiVersion: true, - }; - } -} - -function emitClients(context: SdkContext, namespace: string, clients: SdkClient[]): Record[] { - const retval: Record[] = []; - for (const client of clients) { - if (getNamespace(context, client.name) !== namespace) { - continue; - } - const server = getServerHelper(context, client.service); - const emittedClient = { - name: client.name.split(".").at(-1), - description: getDocStr(context, client.type), - parameters: emitGlobalParameters(context, client.service), - operationGroups: emitOperationGroups(context, client), - url: server ? server.url : "", - apiVersions: [], - arm: client.arm, - }; - const emittedApiVersionParam = getApiVersionParameter(context); - if (emittedApiVersionParam) { - emittedClient.parameters.push(emittedApiVersionParam); - } - if (subscriptionIdParam) { - emittedClient.parameters.push(subscriptionIdParam); - } - retval.push(emittedClient); - } - return retval; -} - -function getServiceNamespace(context: SdkContext): Namespace { - return listServices(context.program)[0].type; -} - -function getNamespace(context: SdkContext, clientName: string): string { - // We get client namespaces from the client name. If there's a dot, we add that to the namespace - const submodule = clientName.split(".").slice(0, -1).join(".").toLowerCase(); - if (!submodule) { - return getClientNamespaceStringHelper(context); - } - return removeUnderscoresFromNamespace(submodule); -} - -function getNamespaces(context: SdkContext): Set { - const namespaces = new Set(); - for (const client of listClients(context)) { - namespaces.add(getNamespace(context, client.name)); - } - return namespaces; -} - -function getClientNamespaceStringHelper(context: SdkContext): string { - return removeUnderscoresFromNamespace(getClientNamespaceString(context)?.toLowerCase()); -} - -function emitCodeModel(sdkContext: SdkContext, clients: SdkClient[]) { - const clientNamespaceString = getClientNamespaceStringHelper(sdkContext); - // Get types - const codeModel: Record = { - namespace: clientNamespaceString, - subnamespaceToClients: {}, - }; - for (const model of getAllModels(sdkContext)) { - if (model.name !== "") { - getType(sdkContext, model); - } - } - for (const namespace of getNamespaces(sdkContext)) { - if (namespace === clientNamespaceString) { - codeModel["clients"] = emitClients(sdkContext, namespace, clients); - } else { - codeModel["subnamespaceToClients"][namespace] = emitClients(sdkContext, namespace, clients); - } - } - codeModel["types"] = [...typesMap.values(), ...Object.values(KnownTypes), ...simpleTypesMap.values()]; - codeModel["crossLanguagePackageId"] = ignoreDiagnostics(getCrossLanguagePackageId(sdkContext)); - return codeModel; -} diff --git a/packages/typespec-python/src/http.ts b/packages/typespec-python/src/http.ts new file mode 100644 index 00000000000..17a7519eb71 --- /dev/null +++ b/packages/typespec-python/src/http.ts @@ -0,0 +1,359 @@ +import { + SdkBasicServiceMethod, + SdkBodyParameter, + SdkClientType, + SdkHeaderParameter, + SdkHttpOperation, + SdkHttpResponse, + SdkLroPagingServiceMethod, + SdkLroServiceMethod, + SdkPagingServiceMethod, + SdkPathParameter, + SdkQueryParameter, + SdkServiceMethod, + SdkServiceResponseHeader, + getCrossLanguageDefinitionId, +} from "@azure-tools/typespec-client-generator-core"; +import { + camelToSnakeCase, + emitParamBase, + getAddedOn, + getDelimeterAndExplode, + getDescriptionAndSummary, + getImplementation, + isAbstract, + isAzureCoreModel, + isSubscriptionId, +} from "./utils.js"; +import { KnownTypes, getType } from "./types.js"; +import { PythonSdkContext } from "./lib.js"; +import { HttpStatusCodeRange } from "@typespec/http"; + +function isContentTypeParameter(parameter: SdkHeaderParameter) { + return parameter.serializedName.toLowerCase() === "content-type"; +} + +export function emitBasicHttpMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkBasicServiceMethod, + operationGroupName: string, +): Record[] { + return [ + { + ...emitHttpOperation(context, rootClient, operationGroupName, method.operation, method), + abstract: isAbstract(method), + internal: method.access === "internal", + name: camelToSnakeCase(method.name), + description: getDescriptionAndSummary(method).description, + summary: getDescriptionAndSummary(method).summary, + }, + ]; +} + +function emitInitialLroHttpMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkLroServiceMethod | SdkLroPagingServiceMethod, + operationGroupName: string, +): Record { + const initialOperation = emitHttpOperation(context, rootClient, operationGroupName, method.operation); + initialOperation.responses.forEach((resp: Record) => { + if (method.operation.responses.get(resp.statusCodes[0])?.type) { + resp["type"] = KnownTypes.anyObject; + } + }); + return { + ...initialOperation, + name: `_${camelToSnakeCase(method.name)}_initial`, + isLroInitialOperation: true, + wantTracing: false, + exposeStreamKeyword: false, + description: getDescriptionAndSummary(method).description, + summary: getDescriptionAndSummary(method).summary, + }; +} + +function addLroInformation( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkLroServiceMethod | SdkLroPagingServiceMethod, + operationGroupName: string, +) { + return { + ...emitHttpOperation(context, rootClient, operationGroupName, method.operation, method), + name: camelToSnakeCase(method.name), + discriminator: "lro", + initialOperation: emitInitialLroHttpMethod(context, rootClient, method, operationGroupName), + exposeStreamKeyword: false, + description: getDescriptionAndSummary(method).description, + summary: getDescriptionAndSummary(method).summary, + }; +} + +function addPagingInformation( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkPagingServiceMethod | SdkLroPagingServiceMethod, + operationGroupName: string, +) { + for (const response of Object.values(method.operation.responses)) { + if (response.type && !isAzureCoreModel(response.type)) { + getType(context, response.type)["pageResultModel"] = true; + } + } + const itemType = getType(context, method.response.type!); + const base = emitHttpOperation(context, rootClient, operationGroupName, method.operation, method); + base.responses.forEach((resp: Record) => { + resp.type = itemType; + }); + return { + ...base, + name: camelToSnakeCase(method.name), + discriminator: "paging", + exposeStreamKeyword: false, + itemName: method.response.resultPath, + continuationTokenName: method.nextLinkPath, + itemType, + description: getDescriptionAndSummary(method).description, + summary: getDescriptionAndSummary(method).summary, + }; +} + +export function emitLroHttpMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkLroServiceMethod, + operationGroupName: string, +): Record[] { + const lroMethod = addLroInformation(context, rootClient, method, operationGroupName); + return [lroMethod.initialOperation, lroMethod]; +} + +export function emitPagingHttpMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkPagingServiceMethod, + operationGroupName: string, +): Record[] { + const pagingMethod = addPagingInformation(context, rootClient, method, operationGroupName); + return [pagingMethod]; +} + +export function emitLroPagingHttpMethod( + context: PythonSdkContext, + rootClient: SdkClientType, + method: SdkLroPagingServiceMethod, + operationGroupName: string, +): Record[] { + const pagingMethod = addPagingInformation(context, rootClient, method, operationGroupName); + const lroMethod = addLroInformation(context, rootClient, method, operationGroupName); + return [lroMethod.initialOperation, pagingMethod, lroMethod]; +} + +function emitHttpOperation( + context: PythonSdkContext, + rootClient: SdkClientType, + operationGroupName: string, + operation: SdkHttpOperation, + method?: SdkServiceMethod, +): Record { + const responses: Record[] = []; + const exceptions: Record[] = []; + for (const [statusCodes, response] of operation.responses) { + responses.push(emitHttpResponse(context, statusCodes, response, method)!); + } + for (const [statusCodes, exception] of operation.exceptions) { + exceptions.push(emitHttpResponse(context, statusCodes, exception)!); + } + const result = { + url: operation.path, + method: operation.verb.toUpperCase(), + parameters: emitHttpParameters(context, rootClient, operation), + bodyParameter: emitHttpBodyParameter(context, operation.bodyParam), + responses, + exceptions, + groupName: operationGroupName, + addedOn: method ? getAddedOn(context, method) : "", + discriminator: "basic", + isOverload: false, + overloads: [], + apiVersions: [], + wantTracing: true, + exposeStreamKeyword: true, + crossLanguageDefinitionId: method ? getCrossLanguageDefinitionId(method) : undefined, + }; + if ( + result.bodyParameter && + operation.bodyParam?.type.kind === "model" && + operation.bodyParam?.type.isGeneratedName + ) { + result.bodyParameter["propertyToParameterName"] = {}; + result.bodyParameter["defaultToUnsetSentinel"] = true; + result.bodyParameter.type.base = "json"; + for (const property of result.bodyParameter.type.properties) { + result.bodyParameter["propertyToParameterName"][property["wireName"]] = property["clientName"]; + result.parameters.push(emitFlattenedParameter(result.bodyParameter, property)); + } + } + return result; +} + +function emitFlattenedParameter( + bodyParameter: Record, + property: Record, +): Record { + return { + checkClientInput: false, + clientDefaultValue: null, + clientName: property.clientName, + delimiter: null, + description: property.description, + implementation: "Method", + inDocstring: true, + inFlattenedBody: true, + inOverload: false, + inOverriden: false, + isApiVersion: bodyParameter["isApiVersion"], + location: "other", + optional: property["optional"], + wireName: null, + skipUrlEncoding: false, + type: property["type"], + defaultToUnsetSentinel: true, + }; +} + +function emitHttpPathParameter(context: PythonSdkContext, parameter: SdkPathParameter) { + const base = emitParamBase(context, parameter); + return { + ...base, + wireName: parameter.serializedName, + location: parameter.kind, + implementation: getImplementation(context, parameter), + clientDefaultValue: parameter.clientDefaultValue, + skipUrlEncoding: parameter.urlEncode === false, + }; +} +function emitHttpHeaderParameter( + context: PythonSdkContext, + parameter: SdkHeaderParameter, +): Record { + const base = emitParamBase(context, parameter); + const [delimiter, explode] = getDelimeterAndExplode(parameter); + let clientDefaultValue = parameter.clientDefaultValue; + if (isContentTypeParameter(parameter)) { + // we switch to string type for content-type header + if (!clientDefaultValue && parameter.type.kind === "constant") { + clientDefaultValue = parameter.type.value; + } + base.type = KnownTypes.string; + } + return { + ...base, + wireName: parameter.serializedName, + location: parameter.kind, + implementation: getImplementation(context, parameter), + delimiter, + explode, + clientDefaultValue, + }; +} + +function emitHttpQueryParameter( + context: PythonSdkContext, + parameter: SdkQueryParameter, +): Record { + const base = emitParamBase(context, parameter); + const [delimiter, explode] = getDelimeterAndExplode(parameter); + return { + ...base, + wireName: parameter.serializedName, + location: parameter.kind, + implementation: getImplementation(context, parameter), + delimiter, + explode, + clientDefaultValue: parameter.clientDefaultValue, + }; +} + +function emitHttpParameters( + context: PythonSdkContext, + rootClient: SdkClientType, + operation: SdkHttpOperation, +): Record[] { + const parameters: Record[] = [...context.__endpointPathParameters]; + for (const parameter of operation.parameters) { + switch (parameter.kind) { + case "header": + parameters.push(emitHttpHeaderParameter(context, parameter)); + break; + case "query": + parameters.push(emitHttpQueryParameter(context, parameter)); + break; + case "path": + parameters.push(emitHttpPathParameter(context, parameter)); + break; + } + if (isSubscriptionId(context, parameter) && context.__subscriptionIdPathParameter === undefined) { + context.__subscriptionIdPathParameter = parameters[parameters.length - 1]; + } + } + return parameters; +} + +function emitHttpBodyParameter( + context: PythonSdkContext, + bodyParam?: SdkBodyParameter, +): Record | undefined { + if (bodyParam === undefined) return undefined; + return { + ...emitParamBase(context, bodyParam, true), + contentTypes: bodyParam.contentTypes, + location: bodyParam.kind, + clientName: bodyParam.isGeneratedName ? "body" : camelToSnakeCase(bodyParam.name), + wireName: bodyParam.isGeneratedName ? "body" : bodyParam.name, + implementation: getImplementation(context, bodyParam), + clientDefaultValue: bodyParam.clientDefaultValue, + defaultContentType: bodyParam.defaultContentType, + }; +} + +function emitHttpResponse( + context: PythonSdkContext, + statusCodes: HttpStatusCodeRange | number | "*", + response: SdkHttpResponse, + method?: SdkServiceMethod, +): Record | undefined { + if (!response) return undefined; + let type = undefined; + if (response.type && !isAzureCoreModel(response.type)) { + type = getType(context, response.type); + } else if (method && method.response.type && !isAzureCoreModel(method.response.type)) { + type = getType(context, method.response.type); + } + return { + headers: response.headers.map((x) => emitHttpResponseHeader(context, x)), + statusCodes: + typeof statusCodes === "object" + ? [(statusCodes as HttpStatusCodeRange).start] + : statusCodes === "*" + ? ["default"] + : [statusCodes], + discriminator: "basic", + type, + contentTypes: response.contentTypes, + defaultContentType: response.defaultContentType ?? "application/json", + resultProperty: method?.response.resultPath, + }; +} + +function emitHttpResponseHeader( + context: PythonSdkContext, + header: SdkServiceResponseHeader, +): Record { + return { + type: getType(context, header.type), + wireName: header.serializedName, + }; +} diff --git a/packages/typespec-python/src/lib.ts b/packages/typespec-python/src/lib.ts index 830efabaa20..bce17d3076d 100644 --- a/packages/typespec-python/src/lib.ts +++ b/packages/typespec-python/src/lib.ts @@ -1,3 +1,4 @@ +import { SdkContext, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core"; import { createTypeSpecLibrary, JSONSchemaType } from "@typespec/compiler"; export interface PythonEmitterOptions { @@ -17,6 +18,12 @@ export interface PythonEmitterOptions { "emit-cross-language-definition-file"?: boolean; } +export interface PythonSdkContext + extends SdkContext { + __endpointPathParameters: Record[]; + __subscriptionIdPathParameter: Record | undefined; +} + const EmitterOptionsSchema: JSONSchemaType = { type: "object", additionalProperties: true, diff --git a/packages/typespec-python/src/types.ts b/packages/typespec-python/src/types.ts index 6ec34e7457d..535cdb08a1f 100644 --- a/packages/typespec-python/src/types.ts +++ b/packages/typespec-python/src/types.ts @@ -1,7 +1,6 @@ import { Type } from "@typespec/compiler"; import { HttpAuth, Visibility } from "@typespec/http"; import { - SdkContext, SdkEnumValueType, SdkType, SdkModelType, @@ -14,11 +13,12 @@ import { SdkConstantType, SdkDatetimeType, SdkDurationType, - getClientType, - shouldFlattenProperty, + SdkCredentialType, + SdkServiceOperation, } from "@azure-tools/typespec-client-generator-core"; import { dump } from "js-yaml"; -import { camelToSnakeCase } from "./utils.js"; +import { camelToSnakeCase, getAddedOn } from "./utils.js"; +import { PythonSdkContext } from "./lib.js"; export const typesMap = new Map>(); export const simpleTypesMap = new Map>(); @@ -41,11 +41,11 @@ function isEmptyModel(type: SdkType): boolean { !type.baseModel && !type.discriminatedSubtypes && !type.discriminatorValue && - (type.name === "" || type.name === "object") + (type.isGeneratedName || type.name === "object") ); } -function getSimpleTypeResult(result: Record): Record { +export function getSimpleTypeResult(result: Record): Record { const key = dump(result, { sortKeys: true }); const value = simpleTypesMap.get(key); if (value) { @@ -56,18 +56,11 @@ function getSimpleTypeResult(result: Record): Record { return result; } -export function getType( - context: SdkContext, +export function getType( + context: PythonSdkContext, type: CredentialType | CredentialTypeUnion | Type | SdkType, fromBody = false, ): Record { - if (type.kind === "Credential") { - return emitCredential(type.scheme); - } - if (type.kind === "CredentialTypeUnion") { - return emitCredentialUnion(type); - } - switch (type.kind) { case "model": return emitModel(context, type, fromBody); @@ -86,6 +79,8 @@ export function getType( return emitDurationOrDateType(type); case "enumvalue": return emitEnumMember(type, emitEnum(type.enumType)); + case "credential": + return emitCredential(type); case "bytes": case "boolean": case "plainDate": @@ -118,26 +113,15 @@ export function getType( return emitBuiltInType(type); case "any": return KnownTypes.any; - case "String": - case "Number": - case "Boolean": - case "Intrinsic": - case "Scalar": - case "Enum": - case "Union": - case "ModelProperty": - case "UnionVariant": - return getType(context, getClientType(context, type)); - case "Model": - return getType(context, getClientType(context, type), fromBody); default: throw Error(`Not supported ${type.kind}`); } } -function emitCredential(auth: HttpAuth): Record { +function emitCredential(credential: SdkCredentialType): Record { let credential_type: Record = {}; - if (auth.type === "oauth2") { + const scheme = credential.scheme; + if (scheme.type === "oauth2") { credential_type = { type: "OAuth2", policy: { @@ -145,45 +129,33 @@ function emitCredential(auth: HttpAuth): Record { credentialScopes: [], }, }; - for (const flow of auth.flows) { + for (const flow of scheme.flows) { for (const scope of flow.scopes) { credential_type.policy.credentialScopes.push(scope.value); } credential_type.policy.credentialScopes.push(); } - } else if (auth.type === "apiKey") { + } else if (scheme.type === "apiKey") { credential_type = { type: "Key", policy: { type: "KeyCredentialPolicy", - key: auth.name, + key: scheme.name, }, }; - } else if (auth.type === "http") { + } else if (scheme.type === "http") { credential_type = { type: "Key", policy: { type: "KeyCredentialPolicy", key: "Authorization", - scheme: auth.scheme[0].toUpperCase() + auth.scheme.slice(1), + scheme: scheme.scheme[0].toUpperCase() + scheme.scheme.slice(1), }, }; } return getSimpleTypeResult(credential_type); } -function emitCredentialUnion(cred_types: CredentialTypeUnion): Record { - const result: Record = {}; - // Export as CombinedType, which is already a Union Type in autorest codegen - result.type = "combined"; - result.types = []; - for (const cred_type of cred_types.types) { - result.types.push(emitCredential(cred_type.scheme)); - } - - return getSimpleTypeResult(result); -} - function visibilityMapping(visibility?: Visibility[]): string[] | undefined { if (visibility === undefined) { return undefined; @@ -205,22 +177,29 @@ function visibilityMapping(visibility?: Visibility[]): string[] | undefined { return result; } -function emitProperty(context: SdkContext, type: SdkBodyModelPropertyType): Record { +function emitProperty( + context: PythonSdkContext, + type: SdkBodyModelPropertyType, +): Record { return { - clientName: camelToSnakeCase(type.nameInClient), + clientName: camelToSnakeCase(type.name), wireName: type.serializedName, type: getType(context, type.type), optional: type.optional, description: type.description, - addedOn: type.apiVersions[0], + addedOn: getAddedOn(context, type), visibility: visibilityMapping(type.visibility), isDiscriminator: type.discriminator, - flatten: shouldFlattenProperty(context, type.__raw!), + flatten: type.flatten, isMultipartFileInput: type.isMultipartFileInput, }; } -function emitModel(context: SdkContext, type: SdkModelType, fromBody: boolean): Record { +function emitModel( + context: PythonSdkContext, + type: SdkModelType, + fromBody: boolean, +): Record { if (isEmptyModel(type)) { return KnownTypes.any; } @@ -230,14 +209,14 @@ function emitModel(context: SdkContext, type: SdkModelType, fromBody: boolean): const parents: Record[] = []; const newValue = { type: type.kind, - name: type.generatedName ?? type.name, + name: type.name, description: type.description, parents: parents, discriminatorValue: type.discriminatorValue, discriminatedSubtypes: {} as Record>, properties: new Array>(), - snakeCaseName: type.name ? camelToSnakeCase(type.name) : type.name, - base: type.name === "" && fromBody ? "json" : "dpg", + snakeCaseName: camelToSnakeCase(type.name), + base: type.isGeneratedName && fromBody ? "json" : "dpg", internal: type.access === "internal", crossLanguageDefinitionId: type.crossLanguageDefinitionId, }; @@ -269,8 +248,30 @@ function emitEnum(type: SdkEnumType): Record { if (typesMap.has(type)) { return typesMap.get(type)!; } + if (type.isGeneratedName) { + const types = []; + for (const value of type.values) { + types.push( + getSimpleTypeResult({ + type: "constant", + value: value.value, + valueType: emitBuiltInType(type.valueType), + }), + ); + } + if (!type.isFixed) { + types.push(emitBuiltInType(type.valueType)); + } + return { + description: "", + internal: true, + type: "combined", + types, + xmlMetadata: {}, + }; + } const values: Record[] = []; - const name = type.generatedName ?? type.name; + const name = type.name; const newValue = { name: name, snakeCaseName: camelToSnakeCase(name), @@ -314,7 +315,10 @@ function emitDurationOrDateType(type: SdkDurationType | SdkDatetimeType): Record }); } -function emitArrayOrDict(context: SdkContext, type: SdkArrayType | SdkDictionaryType): Record { +function emitArrayOrDict( + context: PythonSdkContext, + type: SdkArrayType | SdkDictionaryType, +): Record { const kind = type.kind === "array" ? "list" : type.kind; return getSimpleTypeResult({ type: kind, @@ -377,11 +381,14 @@ function emitBuiltInType(type: SdkBuiltInType | SdkDurationType | SdkDatetimeTyp }); } -function emitUnion(context: SdkContext, type: SdkUnionType): Record { +function emitUnion( + context: PythonSdkContext, + type: SdkUnionType, +): Record { return getSimpleTypeResult({ - name: type.name, - snakeCaseName: camelToSnakeCase(type.name || ""), - description: `Type of ${type.name}`, + name: type.isGeneratedName ? undefined : type.name, + snakeCaseName: type.isGeneratedName ? undefined : camelToSnakeCase(type.name), + description: type.isGeneratedName ? "" : `Type of ${type.name}`, internal: true, type: "combined", types: type.values.map((x) => getType(context, x)), diff --git a/packages/typespec-python/src/utils.ts b/packages/typespec-python/src/utils.ts index d9020772245..5b16e0d9efd 100644 --- a/packages/typespec-python/src/utils.ts +++ b/packages/typespec-python/src/utils.ts @@ -1,3 +1,18 @@ +import { + SdkHeaderParameter, + SdkHttpParameter, + SdkMethod, + SdkModelPropertyType, + SdkParameter, + SdkQueryParameter, + SdkServiceMethod, + SdkServiceOperation, + SdkType, +} from "@azure-tools/typespec-client-generator-core"; +import { getSimpleTypeResult, getType } from "./types.js"; +import { getNamespaceFullName } from "@typespec/compiler"; +import { PythonSdkContext } from "./lib.js"; + export function camelToSnakeCase(name: string): string { if (!name) return name; const camelToSnakeCaseRe = (str: string) => @@ -13,3 +28,119 @@ export function removeUnderscoresFromNamespace(name?: string): string { // needed because of the _specs_ tests return (name || "").replace(/_/g, ""); } + +export function getImplementation( + context: PythonSdkContext, + parameter: SdkParameter | SdkHttpParameter, +): "Client" | "Method" { + if (parameter.onClient) return "Client"; + if (isSubscriptionId(context, parameter)) return "Client"; + return "Method"; +} + +export function isAbstract( + method: SdkServiceMethod, +): boolean { + return (method.operation.bodyParam?.contentTypes.length ?? 0) > 1; +} + +export function getDelimeterAndExplode( + parameter: SdkQueryParameter | SdkHeaderParameter, +): [string | undefined, boolean] { + if (parameter.type.kind !== "array") return [undefined, false]; + let delimiter: string | undefined = undefined; + let explode = false; + if (parameter.collectionFormat === "csv") { + delimiter = "comma"; + } else if (parameter.collectionFormat === "ssv") { + delimiter = "space"; + } else if (parameter.collectionFormat === "tsv") { + delimiter = "tab"; + } else if (parameter.collectionFormat === "pipes") { + delimiter = "pipe"; + } else { + explode = true; + } + return [delimiter, explode]; +} + +type ParamBase = { + optional: boolean; + description: string; + addedOn: string | undefined; + clientName: string; + inOverload: boolean; + isApiVersion: boolean; + type: Record; +}; + +export function getAddedOn( + context: PythonSdkContext, + type: SdkModelPropertyType | SdkMethod, +): string | undefined { + // We only want added on if it's not the same as the client's added on + if (type.apiVersions[0] === context.experimental_sdkPackage.clients[0].apiVersions[0]) return undefined; + return type.apiVersions[0]; +} + +export function isSubscriptionId( + context: PythonSdkContext, + parameter: SdkParameter | SdkHttpParameter, +): boolean { + return ( + Boolean(context.arm) && + (parameter.kind === "query" || parameter.kind === "path" || parameter.kind === "header") && + parameter.serializedName === "subscriptionId" + ); +} + +export function emitParamBase( + context: PythonSdkContext, + parameter: SdkParameter | SdkHttpParameter, + fromBody: boolean = false, +): ParamBase { + let type = getType(context, parameter.type, fromBody); + if (parameter.isApiVersionParam) { + if (parameter.clientDefaultValue) { + type = getSimpleTypeResult({ type: "constant", value: parameter.clientDefaultValue, valueType: type }); + } + } + return { + optional: parameter.optional, + description: parameter.description || "", + addedOn: getAddedOn(context, parameter), + clientName: camelToSnakeCase(parameter.name), + inOverload: false, + isApiVersion: parameter.isApiVersionParam, + type, + }; +} + +export function isAzureCoreModel(t: SdkType | undefined): boolean { + if (!t) return false; + const tspType = t.__raw; + if (!tspType) return false; + return ( + tspType.kind === "Model" && + tspType.namespace !== undefined && + ["Azure.Core", "Azure.Core.Foundations"].includes(getNamespaceFullName(tspType.namespace)) + ); +} + +export function getDescriptionAndSummary( + method: SdkMethod, +): { description?: string; summary?: string } { + if (method.details) { + return { + description: method.details, + summary: method.description, + }; + } + return { + description: method.description ?? "", + }; +} + +export function capitalize(name: string): string { + return name[0].toUpperCase() + name.slice(1); +} diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/README.md b/packages/typespec-python/test/azure/generated/authentication-api-key/README.md index dd86c781cf3..3fb13d287de 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/README.md +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install authentication-apikey diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_client.py b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_client.py index 2c3323fff1c..2d68e4bdecb 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_client.py +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_client.py @@ -22,7 +22,7 @@ class ApiKeyClient(ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.AzureKeyCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_configuration.py b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_configuration.py index 2d44fa5bd27..3280894552d 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_configuration.py +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_configuration.py @@ -20,7 +20,7 @@ class ApiKeyClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.AzureKeyCredential """ diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_operations/_operations.py index c02a6f0866f..450007b7555 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,10 +20,17 @@ from azure.core.pipeline import PipelineResponse from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from .. import models as _models +from .._model_base import _deserialize from .._serialization import Serializer from .._vendor import ApiKeyClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,10 +46,17 @@ def build_api_key_valid_request(**kwargs: Any) -> HttpRequest: def build_api_key_invalid_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/authentication/api-key/invalid" - return HttpRequest(method="GET", url=_url, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) class ApiKeyClientOperationsMixin(ApiKeyClientMixinABC): @@ -53,7 +68,7 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,11 +111,17 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_client.py b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_client.py index 4714b8f8615..c58d80fa49b 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_client.py @@ -22,7 +22,7 @@ class ApiKeyClient(ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.AzureKeyCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_configuration.py b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_configuration.py index d1b6837ddbd..93567831a46 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_configuration.py @@ -20,7 +20,7 @@ class ApiKeyClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.AzureKeyCredential """ diff --git a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py index 7d20bdaa8d8..b8bfd6ed760 100644 --- a/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -20,9 +21,15 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from ... import models as _models +from ..._model_base import _deserialize from ..._operations._operations import build_api_key_invalid_request, build_api_key_valid_request from .._vendor import ApiKeyClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +43,7 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,11 +86,17 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/README.md b/packages/typespec-python/test/azure/generated/authentication-http-custom/README.md index 2b16bc0160d..9b3062642be 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/README.md +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install authentication-http-custom diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_client.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_client.py index 2137a3881bf..610f4f2334e 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_client.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_client.py @@ -22,7 +22,7 @@ class CustomClient(CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.AzureKeyCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_configuration.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_configuration.py index fe1fb22c56c..70bdb2856c8 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_configuration.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_configuration.py @@ -20,7 +20,7 @@ class CustomClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.AzureKeyCredential """ diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py index f2fe9373e24..fc20bd4ebde 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,10 +20,17 @@ from azure.core.pipeline import PipelineResponse from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from .. import models as _models +from .._model_base import _deserialize from .._serialization import Serializer from .._vendor import CustomClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,10 +46,17 @@ def build_custom_valid_request(**kwargs: Any) -> HttpRequest: def build_custom_invalid_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/authentication/http/custom/invalid" - return HttpRequest(method="GET", url=_url, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) class CustomClientOperationsMixin(CustomClientMixinABC): @@ -53,7 +68,7 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,11 +111,17 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_client.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_client.py index 570c8b147ce..91051bd55e7 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_client.py @@ -22,7 +22,7 @@ class CustomClient(CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.AzureKeyCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_configuration.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_configuration.py index f941fdc456d..ec0a91df212 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_configuration.py @@ -20,7 +20,7 @@ class CustomClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.AzureKeyCredential """ diff --git a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py index 59d7c99cdd4..57a8d92fc27 100644 --- a/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -20,9 +21,15 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from ... import models as _models +from ..._model_base import _deserialize from ..._operations._operations import build_custom_invalid_request, build_custom_valid_request from .._vendor import CustomClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +43,7 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,11 +86,17 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/README.md b/packages/typespec-python/test/azure/generated/authentication-oauth2/README.md index 1106528160d..fb30f67510c 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/README.md +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install authentication-oauth2 diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_client.py b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_client.py index 4cd86391360..417d371e1fb 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_client.py +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_client.py @@ -25,7 +25,7 @@ class OAuth2Client(OAuth2ClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with OAuth2 authentication. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_configuration.py b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_configuration.py index f444fd16131..514ef89c2aa 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_configuration.py +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_configuration.py @@ -23,7 +23,7 @@ class OAuth2ClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential """ diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py index 1de35c5bca4..618bea72b25 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,10 +20,17 @@ from azure.core.pipeline import PipelineResponse from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from .. import models as _models +from .._model_base import _deserialize from .._serialization import Serializer from .._vendor import OAuth2ClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,10 +46,17 @@ def build_oauth2_valid_request(**kwargs: Any) -> HttpRequest: def build_oauth2_invalid_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/authentication/oauth2/invalid" - return HttpRequest(method="GET", url=_url, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) class OAuth2ClientOperationsMixin(OAuth2ClientMixinABC): @@ -53,7 +68,7 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,11 +111,17 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_client.py b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_client.py index d8404b53836..24e69d2b95a 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_client.py @@ -25,7 +25,7 @@ class OAuth2Client(OAuth2ClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with OAuth2 authentication. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_configuration.py b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_configuration.py index cfbc9266715..7bc3e5bb971 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_configuration.py @@ -23,7 +23,7 @@ class OAuth2ClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential """ diff --git a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py index 0568e174693..2f547042883 100644 --- a/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -20,9 +21,15 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from ... import models as _models +from ..._model_base import _deserialize from ..._operations._operations import build_oauth2_invalid_request, build_oauth2_valid_request from .._vendor import OAuth2ClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +43,7 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,11 +86,17 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/azure/generated/authentication-union/README.md b/packages/typespec-python/test/azure/generated/authentication-union/README.md index 49095e73cf3..3e07ec9cd59 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/README.md +++ b/packages/typespec-python/test/azure/generated/authentication-union/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install authentication-union diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_client.py b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_client.py index c8fdd35bd42..8559219cda6 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_client.py +++ b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_client.py @@ -26,7 +26,7 @@ class UnionClient(UnionClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey and OAuth2 authentication. - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_configuration.py b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_configuration.py index b5557b6cbfa..2cc39db1fd4 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_configuration.py +++ b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_configuration.py @@ -24,7 +24,7 @@ class UnionClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_operations/_operations.py index 4fa6adbf5fe..809de303275 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import UnionClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ def valid_key(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -96,7 +101,7 @@ def valid_token(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_client.py b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_client.py index ae21ad943e7..89050ab9336 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_client.py @@ -26,7 +26,7 @@ class UnionClient(UnionClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey and OAuth2 authentication. - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_configuration.py b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_configuration.py index 5151d03fa29..9f402d9d023 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_configuration.py @@ -24,7 +24,7 @@ class UnionClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a AzureKeyCredential type or a TokenCredential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential diff --git a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_operations/_operations.py index 13ba5313ed9..c77b68a4bf9 100644 --- a/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/authentication-union/authentication/union/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_union_valid_key_request, build_union_valid_token_request from .._vendor import UnionClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +41,7 @@ async def valid_key(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,7 +84,7 @@ async def valid_token(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/README.md b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/README.md index ff7d9783211..70d89528117 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/README.md +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specs-azure-clientgenerator-core-access diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_operations.py index ae6e3866894..c3c33031467 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +35,10 @@ build_shared_model_in_operation_public_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,7 @@ async def no_decorator_in_public(self, *, name: str, **kwargs: Any) -> _models.N "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,7 +141,7 @@ async def public_decorator_in_public(self, *, name: str, **kwargs: Any) -> _mode "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +223,7 @@ async def _no_decorator_in_internal( # pylint: disable=protected-access "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -286,7 +291,7 @@ async def _internal_decorator_in_internal( # pylint: disable=protected-access "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -354,7 +359,7 @@ async def _public_decorator_in_internal( "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +438,7 @@ async def public(self, *, name: str, **kwargs: Any) -> _models.SharedModel: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -494,7 +499,7 @@ async def _internal(self, *, name: str, **kwargs: Any) -> _models.SharedModel: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +594,7 @@ async def _operation( # pylint: disable=protected-access "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +672,7 @@ async def _discriminator( # pylint: disable=protected-access # response body for status code(s): 200 response == abstract_model """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_models.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_models.py index 13f3b855f4c..a12e11d11fd 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_models.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_models.py @@ -25,17 +25,17 @@ class AbstractModel(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar name: Required. - :vartype name: str :ivar kind: Required. Default value is None. :vartype kind: str + :ivar name: Required. + :vartype name: str """ __mapping__: Dict[str, _model_base.Model] = {} - name: str = rest_field() - """Required.""" kind: str = rest_discriminator(name="kind") """Required. Default value is None.""" + name: str = rest_field() + """Required.""" class BaseModel(_model_base.Model): diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_operations.py index 3d92c54bf97..21b97d101d7 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._model_base import _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -248,7 +253,7 @@ def no_decorator_in_public(self, *, name: str, **kwargs: Any) -> _models.NoDecor "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -310,7 +315,7 @@ def public_decorator_in_public(self, *, name: str, **kwargs: Any) -> _models.Pub "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -392,7 +397,7 @@ def _no_decorator_in_internal( # pylint: disable=protected-access "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -460,7 +465,7 @@ def _internal_decorator_in_internal( # pylint: disable=protected-access "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +531,7 @@ def _public_decorator_in_internal(self, *, name: str, **kwargs: Any) -> _models. "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -605,7 +610,7 @@ def public(self, *, name: str, **kwargs: Any) -> _models.SharedModel: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -666,7 +671,7 @@ def _internal(self, *, name: str, **kwargs: Any) -> _models.SharedModel: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -759,7 +764,7 @@ def _operation(self, *, name: str, **kwargs: Any) -> _models._models.OuterModel: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -837,7 +842,7 @@ def _discriminator( # pylint: disable=protected-access # response body for status code(s): 200 response == abstract_model """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/README.md b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/README.md index 5c70209ae40..8d023ed1513 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/README.md +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install type-model-flatten diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/type/model/flatten/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/type/model/flatten/_operations/_operations.py index 62112e760ea..596916b5c7f 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/type/model/flatten/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/type/model/flatten/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -51,9 +51,9 @@ def build_flatten_put_flatten_model_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/flatten/flattenModel" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, headers=_headers, **kwargs) @@ -68,9 +68,9 @@ def build_flatten_put_nested_flatten_model_request(**kwargs: Any) -> HttpRequest _url = "/type/model/flatten/nestedFlattenModel" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, headers=_headers, **kwargs) @@ -202,7 +202,7 @@ def put_flatten_model( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +398,7 @@ def put_nested_flatten_model( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/type/model/flatten/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/type/model/flatten/aio/_operations/_operations.py index d592c652527..2c444290e93 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/type/model/flatten/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-flatten/type/model/flatten/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -168,7 +168,7 @@ async def put_flatten_model( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +364,7 @@ async def put_nested_flatten_model( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/README.md b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/README.md index cc87bbd9a30..c211c3e8f86 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/README.md +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specs-azure-clientgenerator-core-usage diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py index 549cb0b7d5d..9e8c17f0903 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -157,7 +157,7 @@ async def input_to_input_output( # pylint: disable=inconsistent-return-statemen "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +224,7 @@ async def output_to_input_output(self, **kwargs: Any) -> _models.OutputModel: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py index 8458996e677..99b96a26c39 100644 --- a/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -189,7 +189,7 @@ def input_to_input_output( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +256,7 @@ def output_to_input_output(self, **kwargs: Any) -> _models.OutputModel: "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/README.md b/packages/typespec-python/test/azure/generated/azure-core-basic/README.md index 7ca26b9ff12..1feab0c61bd 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specs-azure-core-basic diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/aio/operations/_operations.py index d4968fb89fe..bf8f715393f 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -92,7 +92,7 @@ def list_first_item(self, **kwargs: Any) -> AsyncIterable["_models.FirstItem"]: cls: ClsType[List[_models.FirstItem]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +175,7 @@ def list_second_item(self, **kwargs: Any) -> AsyncIterable["_models.SecondItem"] cls: ClsType[List[_models.SecondItem]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +411,7 @@ async def create_or_update( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -645,7 +645,7 @@ async def create_or_replace( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +735,7 @@ async def get(self, id: int, **kwargs: Any) -> _models.User: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,7 +836,7 @@ def list( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -934,7 +934,7 @@ def list_with_page(self, **kwargs: Any) -> AsyncIterable["_models.User"]: cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1171,7 +1171,7 @@ def list_with_parameters( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1271,7 @@ def list_with_custom_page_model(self, **kwargs: Any) -> AsyncIterable["_models.U cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1344,7 +1344,7 @@ async def delete(self, id: int, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1412,7 +1412,7 @@ async def export(self, id: int, *, format: str, **kwargs: Any) -> _models.User: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/models/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/models/__init__.py index 57a0f29deb2..72d186434f1 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/models/__init__.py @@ -10,6 +10,7 @@ from ._models import ListItemInputBody from ._models import SecondItem from ._models import User +from ._models import UserListResults from ._models import UserOrder from ._enums import ListItemInputExtensibleEnum @@ -22,6 +23,7 @@ "ListItemInputBody", "SecondItem", "User", + "UserListResults", "UserOrder", "ListItemInputExtensibleEnum", ] diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/models/_models.py b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/models/_models.py index 924f1728a5c..1237bed2872 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/models/_models.py +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/models/_models.py @@ -124,6 +124,42 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class UserListResults(_model_base.Model): + """UserListResults. + + All required parameters must be populated in order to send to server. + + :ivar items_property: List of items. Required. + :vartype items_property: list[~specs.azure.core.basic.models.User] + :ivar next_link: Link to fetch more items. + :vartype next_link: str + """ + + items_property: List["_models.User"] = rest_field(name="items") + """List of items. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """Link to fetch more items.""" + + @overload + def __init__( + self, + *, + items_property: List["_models.User"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class UserOrder(_model_base.Model): """UserOrder for testing list with expand. diff --git a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/operations/_operations.py index c1b365841a1..c66982a758a 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-basic/specs/azure/core/basic/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -132,9 +132,9 @@ def build_basic_create_or_replace_request(id: int, **kwargs: Any) -> HttpRequest _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -244,9 +244,9 @@ def build_basic_list_with_parameters_request( _params["another"] = _SERIALIZER.query("another", another, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -271,9 +271,12 @@ def build_basic_list_with_custom_page_model_request(**kwargs: Any) -> HttpReques def build_basic_delete_request(id: int, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/azure/core/basic/users/{id}" path_format_arguments = { @@ -285,7 +288,10 @@ def build_basic_delete_request(id: int, **kwargs: Any) -> HttpRequest: # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_basic_export_request(id: int, *, format: str, **kwargs: Any) -> HttpRequest: @@ -352,7 +358,7 @@ def list_first_item(self, **kwargs: Any) -> Iterable["_models.FirstItem"]: cls: ClsType[List[_models.FirstItem]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +441,7 @@ def list_second_item(self, **kwargs: Any) -> Iterable["_models.SecondItem"]: cls: ClsType[List[_models.SecondItem]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -669,7 +675,7 @@ def create_or_update(self, id: int, resource: Union[_models.User, JSON, IO[bytes ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -901,7 +907,7 @@ def create_or_replace(self, id: int, resource: Union[_models.User, JSON, IO[byte ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -991,7 +997,7 @@ def get(self, id: int, **kwargs: Any) -> _models.User: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1092,7 +1098,7 @@ def list( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1190,7 +1196,7 @@ def list_with_page(self, **kwargs: Any) -> Iterable["_models.User"]: cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1427,7 +1433,7 @@ def list_with_parameters( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1527,7 +1533,7 @@ def list_with_custom_page_model(self, **kwargs: Any) -> Iterable["_models.User"] cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1600,7 +1606,7 @@ def delete(self, id: int, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1668,7 +1674,7 @@ def export(self, id: int, *, format: str, **kwargs: Any) -> _models.User: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/README.md b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/README.md index 2669b147fdc..661ab3f6f2b 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specs-azure-core-lro-standard diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_operations.py index 517026fd9d8..4d39879cece 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -63,9 +63,9 @@ def build_standard_create_or_replace_request(name: str, **kwargs: Any) -> HttpRe _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -123,7 +123,7 @@ class StandardClientOperationsMixin(StandardClientMixinABC): def _create_or_replace_initial( self, name: str, resource: Union[_models.User, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -362,7 +362,7 @@ def get_long_running_output(pipeline_response): ) def _delete_initial(self, name: str, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -451,7 +451,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _export_initial(self, name: str, *, format: str, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_operations.py index 53ffe7a6737..9aea59b38bd 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -48,7 +48,7 @@ class StandardClientOperationsMixin(StandardClientMixinABC): async def _create_or_replace_initial( self, name: str, resource: Union[_models.User, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -291,7 +291,7 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial(self, name: str, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -380,7 +380,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _export_initial(self, name: str, *, format: str, **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/CHANGELOG.md b/packages/typespec-python/test/azure/generated/azure-core-scalar/CHANGELOG.md similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/CHANGELOG.md rename to packages/typespec-python/test/azure/generated/azure-core-scalar/CHANGELOG.md diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/LICENSE b/packages/typespec-python/test/azure/generated/azure-core-scalar/LICENSE similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/LICENSE rename to packages/typespec-python/test/azure/generated/azure-core-scalar/LICENSE diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/MANIFEST.in b/packages/typespec-python/test/azure/generated/azure-core-scalar/MANIFEST.in new file mode 100644 index 00000000000..49876ec2108 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/MANIFEST.in @@ -0,0 +1,8 @@ +include *.md +include LICENSE +include specs/azure/core/scalar/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include specs/__init__.py +include specs/azure/__init__.py +include specs/azure/core/__init__.py \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/README.md b/packages/typespec-python/test/azure/generated/azure-core-scalar/README.md similarity index 90% rename from packages/typespec-python/test/azure/generated/projection-projected-name/README.md rename to packages/typespec-python/test/azure/generated/azure-core-scalar/README.md index dda8e6743b0..47715611192 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/README.md @@ -1,21 +1,21 @@ -# Projection Projectedname client library for Python +# Specs Azure Core Scalar client library for Python ## Getting started -### Installating the package +### Install the package ```bash -python -m pip install projection-projectedname +python -m pip install specs-azure-core-scalar ``` #### Prequisites - Python 3.8 or later is required to use this package. - You need an [Azure subscription][azure_sub] to use this package. -- An existing Projection Projectedname instance. +- An existing Specs Azure Core Scalar instance. ## Contributing diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/dev_requirements.txt b/packages/typespec-python/test/azure/generated/azure-core-scalar/dev_requirements.txt similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/dev_requirements.txt rename to packages/typespec-python/test/azure/generated/azure-core-scalar/dev_requirements.txt diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/setup.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/setup.py new file mode 100644 index 00000000000..80f4168d701 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/setup.py @@ -0,0 +1,72 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +import os +import re +from setuptools import setup, find_packages + + +PACKAGE_NAME = "specs-azure-core-scalar" +PACKAGE_PPRINT_NAME = "Specs Azure Core Scalar" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError("Cannot find version information") + + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=open("README.md", "r").read(), + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python/tree/main/sdk", + keywords="azure, azure sdk", + classifiers=[ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "specs", + "specs.azure", + "specs.azure.core", + ] + ), + include_package_data=True, + package_data={ + "specs.azure.core.scalar": ["py.typed"], + }, + install_requires=[ + "isodate>=0.6.1", + "azure-core>=1.30.0", + "typing-extensions>=4.6.0", + ], + python_requires=">=3.8", +) diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/__init__.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/__init__.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/__init__.py diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/__init__.py similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/__init__.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/__init__.py diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/__init__.py similarity index 92% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/__init__.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/__init__.py index da716eeb7d7..49703f77b50 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._client import ProjectedNameClient +from ._client import ScalarClient from ._version import VERSION __version__ = VERSION @@ -19,7 +19,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ProjectedNameClient", + "ScalarClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_client.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_client.py similarity index 79% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_client.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_client.py index 57fcf3378df..619b32db4f2 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_client.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_client.py @@ -13,18 +13,17 @@ from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse -from ._configuration import ProjectedNameClientConfiguration +from ._configuration import ScalarClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import ModelOperations, ProjectedNameClientOperationsMixin, PropertyOperations +from .operations import AzureLocationScalarOperations -class ProjectedNameClient(ProjectedNameClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Projection. +class ScalarClient: # pylint: disable=client-accepts-api-version-keyword + """ScalarClient. - :ivar property: PropertyOperations operations - :vartype property: projection.projectedname.operations.PropertyOperations - :ivar model: ModelOperations operations - :vartype model: projection.projectedname.operations.ModelOperations + :ivar azure_location_scalar: AzureLocationScalarOperations operations + :vartype azure_location_scalar: + specs.azure.core.scalar.operations.AzureLocationScalarOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -32,7 +31,7 @@ class ProjectedNameClient(ProjectedNameClientOperationsMixin): # pylint: disabl def __init__( # pylint: disable=missing-client-constructor-parameter-credential self, *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = ProjectedNameClientConfiguration(**kwargs) + self._config = ScalarClientConfiguration(**kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -55,8 +54,9 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.property = PropertyOperations(self._client, self._config, self._serialize, self._deserialize) - self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) + self.azure_location_scalar = AzureLocationScalarOperations( + self._client, self._config, self._serialize, self._deserialize + ) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -83,7 +83,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "ProjectedNameClient": + def __enter__(self) -> "ScalarClient": self._client.__enter__() return self diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_configuration.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_configuration.py similarity index 88% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_configuration.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_configuration.py index 5726f2a2e5f..21b94f6cff6 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_configuration.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_configuration.py @@ -13,8 +13,8 @@ from ._version import VERSION -class ProjectedNameClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ProjectedNameClient. +class ScalarClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ScalarClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -22,7 +22,7 @@ class ProjectedNameClientConfiguration: # pylint: disable=too-many-instance-att def __init__(self, **kwargs: Any) -> None: - kwargs.setdefault("sdk_moniker", "projection-projectedname/{}".format(VERSION)) + kwargs.setdefault("sdk_moniker", "specs-azure-core-scalar/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_model_base.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_model_base.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_model_base.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_model_base.py diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_patch.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_patch.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_patch.py diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_serialization.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_serialization.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_serialization.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_serialization.py diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_version.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_version.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_version.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/_version.py diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/__init__.py similarity index 91% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/__init__.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/__init__.py index fc9c0d6748e..f729352a2f2 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._client import ProjectedNameClient +from ._client import ScalarClient try: from ._patch import __all__ as _patch_all @@ -16,7 +16,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ProjectedNameClient", + "ScalarClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_client.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/_client.py similarity index 80% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_client.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/_client.py index 8c358853d3f..0926b7518a1 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/_client.py @@ -14,17 +14,16 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._serialization import Deserializer, Serializer -from ._configuration import ProjectedNameClientConfiguration -from .operations import ModelOperations, ProjectedNameClientOperationsMixin, PropertyOperations +from ._configuration import ScalarClientConfiguration +from .operations import AzureLocationScalarOperations -class ProjectedNameClient(ProjectedNameClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Projection. +class ScalarClient: # pylint: disable=client-accepts-api-version-keyword + """ScalarClient. - :ivar property: PropertyOperations operations - :vartype property: projection.projectedname.aio.operations.PropertyOperations - :ivar model: ModelOperations operations - :vartype model: projection.projectedname.aio.operations.ModelOperations + :ivar azure_location_scalar: AzureLocationScalarOperations operations + :vartype azure_location_scalar: + specs.azure.core.scalar.aio.operations.AzureLocationScalarOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -32,7 +31,7 @@ class ProjectedNameClient(ProjectedNameClientOperationsMixin): # pylint: disabl def __init__( # pylint: disable=missing-client-constructor-parameter-credential self, *, endpoint: str = "http://localhost:3000", **kwargs: Any ) -> None: - self._config = ProjectedNameClientConfiguration(**kwargs) + self._config = ScalarClientConfiguration(**kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -55,8 +54,9 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.property = PropertyOperations(self._client, self._config, self._serialize, self._deserialize) - self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) + self.azure_location_scalar = AzureLocationScalarOperations( + self._client, self._config, self._serialize, self._deserialize + ) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any @@ -85,7 +85,7 @@ def send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "ProjectedNameClient": + async def __aenter__(self) -> "ScalarClient": await self._client.__aenter__() return self diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_configuration.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/_configuration.py similarity index 88% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_configuration.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/_configuration.py index 90589968375..3466618b547 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/_configuration.py @@ -13,8 +13,8 @@ from .._version import VERSION -class ProjectedNameClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ProjectedNameClient. +class ScalarClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ScalarClient. Note that all parameters used to create this instance are saved as instance attributes. @@ -22,7 +22,7 @@ class ProjectedNameClientConfiguration: # pylint: disable=too-many-instance-att def __init__(self, **kwargs: Any) -> None: - kwargs.setdefault("sdk_moniker", "projection-projectedname/{}".format(VERSION)) + kwargs.setdefault("sdk_moniker", "specs-azure-core-scalar/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_patch.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_patch.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/operations/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/__init__.py similarity index 74% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/operations/__init__.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/__init__.py index a3020a0ebe3..f4250b7b97c 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/__init__.py @@ -6,18 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import PropertyOperations -from ._operations import ModelOperations -from ._operations import ProjectedNameClientOperationsMixin +from ._operations import AzureLocationScalarOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PropertyOperations", - "ModelOperations", - "ProjectedNameClientOperationsMixin", + "AzureLocationScalarOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_operations.py new file mode 100644 index 00000000000..17d0c946b52 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_operations.py @@ -0,0 +1,407 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, 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 ..._model_base import SdkJSONEncoder, _deserialize +from ...operations._operations import ( + build_azure_location_scalar_get_request, + build_azure_location_scalar_header_request, + build_azure_location_scalar_post_request, + build_azure_location_scalar_put_request, + build_azure_location_scalar_query_request, +) + +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 +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AzureLocationScalarOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.core.scalar.aio.ScalarClient`'s + :attr:`azure_location_scalar` attribute. + """ + + 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(self, **kwargs: Any) -> str: + """get azureLocation value. + + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_azure_location_scalar_get_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(str, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """put azureLocation value. + + :param body: _. Required. + :type body: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_azure_location_scalar_put_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def post( + self, body: _models.AzureLocationModel, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AzureLocationModel: + """post a model which has azureLocation property. + + :param body: _. Required. + :type body: ~specs.azure.core.scalar.models.AzureLocationModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureLocationModel. The AzureLocationModel is compatible with MutableMapping + :rtype: ~specs.azure.core.scalar.models.AzureLocationModel + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "location": "str" # Required. + } + + # response body for status code(s): 200 + response == { + "location": "str" # Required. + } + """ + + @overload + async def post( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AzureLocationModel: + """post a model which has azureLocation property. + + :param body: _. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureLocationModel. The AzureLocationModel is compatible with MutableMapping + :rtype: ~specs.azure.core.scalar.models.AzureLocationModel + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str" # Required. + } + """ + + @overload + async def post( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AzureLocationModel: + """post a model which has azureLocation property. + + :param body: _. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureLocationModel. The AzureLocationModel is compatible with MutableMapping + :rtype: ~specs.azure.core.scalar.models.AzureLocationModel + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str" # Required. + } + """ + + @distributed_trace_async + async def post( + self, body: Union[_models.AzureLocationModel, JSON, IO[bytes]], **kwargs: Any + ) -> _models.AzureLocationModel: + """post a model which has azureLocation property. + + :param body: _. Is one of the following types: AzureLocationModel, JSON, IO[bytes] Required. + :type body: ~specs.azure.core.scalar.models.AzureLocationModel or JSON or IO[bytes] + :return: AzureLocationModel. The AzureLocationModel is compatible with MutableMapping + :rtype: ~specs.azure.core.scalar.models.AzureLocationModel + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "location": "str" # Required. + } + + # response body for status code(s): 200 + response == { + "location": "str" # Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureLocationModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_azure_location_scalar_post_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureLocationModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def header(self, *, region: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """azureLocation value header. + + :keyword region: _. Required. + :paramtype region: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_azure_location_scalar_header_request( + region=region, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def query(self, *, region: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """azureLocation value query. + + :keyword region: _. Required. + :paramtype region: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_azure_location_scalar_query_request( + region=region, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/operations/_patch.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/operations/_patch.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/models/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/models/__init__.py similarity index 90% rename from packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/models/__init__.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/models/__init__.py index be2a6e46583..28ffd768858 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/models/__init__.py @@ -6,13 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._enums import ImmediateSuccessResponse +from ._models import AzureLocationModel from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ImmediateSuccessResponse", + "AzureLocationModel", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/models/_models.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/models/_models.py new file mode 100644 index 00000000000..8d8b80baa45 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/models/_models.py @@ -0,0 +1,44 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Mapping, overload + +from .. import _model_base +from .._model_base import rest_field + + +class AzureLocationModel(_model_base.Model): + """AzureLocationModel. + + All required parameters must be populated in order to send to server. + + :ivar location: Required. + :vartype location: str + """ + + location: str = rest_field() + """Required.""" + + @overload + def __init__( + self, + *, + location: str, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/models/_patch.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/models/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/models/_patch.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/models/_patch.py diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/__init__.py similarity index 74% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/operations/__init__.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/__init__.py index a3020a0ebe3..f4250b7b97c 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/__init__.py @@ -6,18 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import PropertyOperations -from ._operations import ModelOperations -from ._operations import ProjectedNameClientOperationsMixin +from ._operations import AzureLocationScalarOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PropertyOperations", - "ModelOperations", - "ProjectedNameClientOperationsMixin", + "AzureLocationScalarOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_operations.py new file mode 100644 index 00000000000..a1adf3dd59a --- /dev/null +++ b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_operations.py @@ -0,0 +1,474 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import json +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from .. import models as _models +from .._model_base import SdkJSONEncoder, _deserialize +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 +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_azure_location_scalar_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/azure/core/scalar/azureLocation" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_azure_location_scalar_put_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/azure/core/scalar/azureLocation" + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + +def build_azure_location_scalar_post_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/azure/core/scalar/azureLocation" + + # Construct headers + if content_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_azure_location_scalar_header_request( # pylint: disable=name-too-long + *, region: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + # Construct URL + _url = "/azure/core/scalar/azureLocation/header" + + # Construct headers + _headers["region"] = _SERIALIZER.header("region", region, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_azure_location_scalar_query_request( # pylint: disable=name-too-long + *, region: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/azure/core/scalar/azureLocation/query" + + # Construct parameters + _params["region"] = _SERIALIZER.query("region", region, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +class AzureLocationScalarOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.core.scalar.ScalarClient`'s + :attr:`azure_location_scalar` attribute. + """ + + 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(self, **kwargs: Any) -> str: + """get azureLocation value. + + :return: str + :rtype: str + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[str] = kwargs.pop("cls", None) + + _request = build_azure_location_scalar_get_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(str, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """put azureLocation value. + + :param body: _. Required. + :type body: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_azure_location_scalar_put_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def post( + self, body: _models.AzureLocationModel, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AzureLocationModel: + """post a model which has azureLocation property. + + :param body: _. Required. + :type body: ~specs.azure.core.scalar.models.AzureLocationModel + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureLocationModel. The AzureLocationModel is compatible with MutableMapping + :rtype: ~specs.azure.core.scalar.models.AzureLocationModel + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "location": "str" # Required. + } + + # response body for status code(s): 200 + response == { + "location": "str" # Required. + } + """ + + @overload + def post(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.AzureLocationModel: + """post a model which has azureLocation property. + + :param body: _. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureLocationModel. The AzureLocationModel is compatible with MutableMapping + :rtype: ~specs.azure.core.scalar.models.AzureLocationModel + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str" # Required. + } + """ + + @overload + def post( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.AzureLocationModel: + """post a model which has azureLocation property. + + :param body: _. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureLocationModel. The AzureLocationModel is compatible with MutableMapping + :rtype: ~specs.azure.core.scalar.models.AzureLocationModel + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "location": "str" # Required. + } + """ + + @distributed_trace + def post( + self, body: Union[_models.AzureLocationModel, JSON, IO[bytes]], **kwargs: Any + ) -> _models.AzureLocationModel: + """post a model which has azureLocation property. + + :param body: _. Is one of the following types: AzureLocationModel, JSON, IO[bytes] Required. + :type body: ~specs.azure.core.scalar.models.AzureLocationModel or JSON or IO[bytes] + :return: AzureLocationModel. The AzureLocationModel is compatible with MutableMapping + :rtype: ~specs.azure.core.scalar.models.AzureLocationModel + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "location": "str" # Required. + } + + # response body for status code(s): 200 + response == { + "location": "str" # Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureLocationModel] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_azure_location_scalar_post_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureLocationModel, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def header(self, *, region: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """azureLocation value header. + + :keyword region: _. Required. + :paramtype region: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_azure_location_scalar_header_request( + region=region, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def query(self, *, region: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """azureLocation value query. + + :keyword region: _. Required. + :paramtype region: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_azure_location_scalar_query_request( + region=region, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/operations/_patch.py b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/operations/_patch.py rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/py.typed b/packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/py.typed similarity index 100% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/py.typed rename to packages/typespec-python/test/azure/generated/azure-core-scalar/specs/azure/core/scalar/py.typed diff --git a/packages/typespec-python/test/azure/generated/azure-core-traits/README.md b/packages/typespec-python/test/azure/generated/azure-core-traits/README.md index 50c01a27f61..99e19bc29f4 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-traits/README.md +++ b/packages/typespec-python/test/azure/generated/azure-core-traits/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specs-azure-core-traits diff --git a/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/_operations/_operations.py index 96dd6fa0626..587f65639da 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/_operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import uuid from azure.core import MatchConditions @@ -115,9 +115,9 @@ def build_traits_repeatable_action_request(id: int, **kwargs: Any) -> HttpReques _headers["Repeatability-First-Sent"] = _SERIALIZER.serialize_data( datetime.datetime.now(datetime.timezone.utc), "rfc-1123" ) - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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) @@ -165,7 +165,7 @@ def smoke_test( "name": "str" # Optional. The user's name. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +337,7 @@ def repeatable_action( "userActionResult": "str" # User action result. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/aio/_operations/_operations.py index e5898dd762c..4a519385174 100644 --- a/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-core-traits/specs/azure/core/traits/aio/_operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core import MatchConditions from azure.core.exceptions import ( @@ -84,7 +84,7 @@ async def smoke_test( "name": "str" # Optional. The user's name. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +256,7 @@ async def repeatable_action( "userActionResult": "str" # User action result. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/README.md b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/README.md index a6ef9b29a2d..700fb6b0b35 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/README.md +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install azure-mgmt-spheredpg diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py index 93531aa3968..c832ff8c050 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_client.py @@ -55,7 +55,7 @@ class AzureSphereClient: # pylint: disable=client-accepts-api-version-keyword,t :vartype devices: azure.mgmt.spheredpg.operations.DevicesOperations :ivar products: ProductsOperations operations :vartype products: azure.mgmt.spheredpg.operations.ProductsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py index a383f43c735..eeabd380351 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/_configuration.py @@ -24,7 +24,7 @@ class AzureSphereClientConfiguration: # pylint: disable=too-many-instance-attri Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py index 51edcee5b1b..420fc219a4a 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_client.py @@ -55,7 +55,7 @@ class AzureSphereClient: # pylint: disable=client-accepts-api-version-keyword,t :vartype devices: azure.mgmt.spheredpg.aio.operations.DevicesOperations :ivar products: ProductsOperations operations :vartype products: azure.mgmt.spheredpg.aio.operations.ProductsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py index 729b5470fc3..dc70360cd62 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/_configuration.py @@ -24,7 +24,7 @@ class AzureSphereClientConfiguration: # pylint: disable=too-many-instance-attri Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py index 1688548c9e1..e3204e3ad08 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -150,7 +150,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +300,7 @@ async def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -354,7 +354,7 @@ async def _create_or_update_initial( resource: Union[_models.Catalog, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1066,7 +1066,7 @@ async def update( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1126,7 +1126,7 @@ async def update( async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1165,8 +1165,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -1174,7 +1174,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete( self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ArmOperationStatus]: + ) -> AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1182,15 +1182,17 @@ async def begin_delete( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :return: An instance of AsyncLROPoller that returns ArmOperationStatus. The ArmOperationStatus - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of AsyncLROPoller that returns + ArmOperationStatusResourceProvisioningState. The ArmOperationStatusResourceProvisioningState is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -1218,7 +1220,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -1235,7 +1237,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1247,13 +1249,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ArmOperationStatus].from_continuation_token( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ArmOperationStatus]( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -1312,7 +1314,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy cls: ClsType[List[_models.Catalog]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1428,7 +1430,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Catalog" cls: ClsType[List[_models.Catalog]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1514,7 +1516,7 @@ async def count_devices( "value": 0 # Number of children resources in parent resource. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1611,7 +1613,7 @@ def list_device_insights( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1759,7 +1761,7 @@ def list_devices( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1955,7 +1957,7 @@ def list_deployments( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2369,7 +2371,7 @@ def list_device_groups( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2530,7 +2532,7 @@ async def get(self, resource_group_name: str, catalog_name: str, image_name: str } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2663,7 +2665,7 @@ def list_by_catalog( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2740,7 +2742,7 @@ async def _create_or_update_initial( resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3268,7 +3270,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3308,8 +3310,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -3317,7 +3319,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete( self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ArmOperationStatus]: + ) -> AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3327,15 +3329,17 @@ async def begin_delete( :type catalog_name: str :param image_name: Image name. Use .default for image creation. Required. :type image_name: str - :return: An instance of AsyncLROPoller that returns ArmOperationStatus. The ArmOperationStatus - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of AsyncLROPoller that returns + ArmOperationStatusResourceProvisioningState. The ArmOperationStatusResourceProvisioningState is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -3363,7 +3367,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -3381,7 +3385,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3393,13 +3397,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ArmOperationStatus].from_continuation_token( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ArmOperationStatus]( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -3506,7 +3510,7 @@ def list_by_product( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3643,7 +3647,7 @@ async def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3701,7 +3705,7 @@ async def _create_or_update_initial( resource: Union[_models.DeviceGroup, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4223,7 +4227,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4264,8 +4268,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -4273,7 +4277,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ArmOperationStatus]: + ) -> AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. @@ -4286,15 +4290,17 @@ async def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :return: An instance of AsyncLROPoller that returns ArmOperationStatus. The ArmOperationStatus - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of AsyncLROPoller that returns + ArmOperationStatusResourceProvisioningState. The ArmOperationStatusResourceProvisioningState is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -4322,7 +4328,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -4341,7 +4347,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4353,13 +4359,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ArmOperationStatus].from_continuation_token( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ArmOperationStatus]( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -4372,7 +4378,7 @@ async def _update_initial( properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4427,8 +4433,8 @@ async def _update_initial( deserialized = _deserialize(JSON, response.json()) if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -4489,7 +4495,7 @@ async def begin_update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -4571,7 +4577,7 @@ async def begin_update( Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -4653,7 +4659,7 @@ async def begin_update( Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -4747,7 +4753,7 @@ async def begin_update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -4865,7 +4871,7 @@ async def count_devices( "value": 0 # Number of children resources in parent resource. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5066,7 +5072,7 @@ async def claim_devices( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5202,7 +5208,7 @@ async def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5329,7 +5335,7 @@ def list_by_catalog( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5425,7 +5431,7 @@ async def retrieve_cert_chain( "certificateChain": "str" # Optional. The certificate chain. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5687,7 +5693,7 @@ async def retrieve_proof_of_possession_nonce( "thumbprint": "str" # Optional. The certificate thumbprint. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5885,7 +5891,7 @@ async def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6069,7 +6075,7 @@ def list_by_device_group( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6150,7 +6156,7 @@ async def _create_or_update_initial( resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6972,7 +6978,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements deployment_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7014,8 +7020,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -7029,7 +7035,7 @@ async def begin_delete( device_group_name: str, deployment_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ArmOperationStatus]: + ) -> AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. @@ -7045,15 +7051,17 @@ async def begin_delete( :param deployment_name: Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. Required. :type deployment_name: str - :return: An instance of AsyncLROPoller that returns ArmOperationStatus. The ArmOperationStatus - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of AsyncLROPoller that returns + ArmOperationStatusResourceProvisioningState. The ArmOperationStatusResourceProvisioningState is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -7081,7 +7089,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -7101,7 +7109,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7113,13 +7121,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ArmOperationStatus].from_continuation_token( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ArmOperationStatus]( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -7214,7 +7222,7 @@ async def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7274,7 +7282,7 @@ async def _create_or_update_initial( resource: Union[_models.Device, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7865,7 +7873,7 @@ def list_by_device_group( cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7941,7 +7949,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements device_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7983,8 +7991,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -7998,7 +8006,7 @@ async def begin_delete( device_group_name: str, device_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ArmOperationStatus]: + ) -> AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Device. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -8012,15 +8020,17 @@ async def begin_delete( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :return: An instance of AsyncLROPoller that returns ArmOperationStatus. The ArmOperationStatus - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of AsyncLROPoller that returns + ArmOperationStatusResourceProvisioningState. The ArmOperationStatusResourceProvisioningState is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -8048,7 +8058,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -8068,7 +8078,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8080,13 +8090,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ArmOperationStatus].from_continuation_token( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ArmOperationStatus]( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -8102,7 +8112,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.Device]: + ) -> _models.Device: # pylint: disable=line-too-long """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. @@ -8123,8 +8133,8 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Device or None. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device or None + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8137,7 +8147,7 @@ async def update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -8191,7 +8201,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.Device]: + ) -> _models.Device: # pylint: disable=line-too-long """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. @@ -8212,14 +8222,14 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Device or None. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device or None + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -8273,7 +8283,7 @@ async def update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.Device]: + ) -> _models.Device: # pylint: disable=line-too-long """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. @@ -8294,14 +8304,14 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Device or None. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device or None + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -8353,7 +8363,7 @@ async def update( device_name: str, properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Device]: + ) -> _models.Device: # pylint: disable=line-too-long """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. @@ -8372,8 +8382,8 @@ async def update( :param properties: The resource properties to be updated. Is one of the following types: DeviceUpdate, JSON, IO[bytes] Required. :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] - :return: Device or None. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device or None + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8386,7 +8396,7 @@ async def update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -8427,7 +8437,7 @@ async def update( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8439,7 +8449,7 @@ async def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Device]] = kwargs.pop("cls", None) + cls: ClsType[_models.Device] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -8477,7 +8487,6 @@ async def update( error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} if response.status_code == 200: if _stream: @@ -8488,6 +8497,11 @@ async def update( if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8505,7 +8519,7 @@ async def generate_capability_image( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.SignedCapabilityImageResponse]: + ) -> _models.SignedCapabilityImageResponse: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. @@ -8526,9 +8540,9 @@ async def generate_capability_image( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse or None. The SignedCapabilityImageResponse is compatible - with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse or None + :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8541,7 +8555,7 @@ async def generate_capability_image( ] } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "image": "str" # Optional. The signed device capability image as a UTF-8 encoded base 64 string. @@ -8560,7 +8574,7 @@ async def generate_capability_image( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.SignedCapabilityImageResponse]: + ) -> _models.SignedCapabilityImageResponse: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. @@ -8581,15 +8595,15 @@ async def generate_capability_image( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse or None. The SignedCapabilityImageResponse is compatible - with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse or None + :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "image": "str" # Optional. The signed device capability image as a UTF-8 encoded base 64 string. @@ -8608,7 +8622,7 @@ async def generate_capability_image( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.SignedCapabilityImageResponse]: + ) -> _models.SignedCapabilityImageResponse: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. @@ -8629,15 +8643,15 @@ async def generate_capability_image( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse or None. The SignedCapabilityImageResponse is compatible - with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse or None + :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "image": "str" # Optional. The signed device capability image as a UTF-8 encoded base 64 string. @@ -8654,7 +8668,7 @@ async def generate_capability_image( device_name: str, parameters: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SignedCapabilityImageResponse]: + ) -> _models.SignedCapabilityImageResponse: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. @@ -8674,9 +8688,9 @@ async def generate_capability_image( GenerateCapabilityImageRequest, JSON, IO[bytes] Required. :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or IO[bytes] - :return: SignedCapabilityImageResponse or None. The SignedCapabilityImageResponse is compatible - with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse or None + :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -8689,13 +8703,13 @@ async def generate_capability_image( ] } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "image": "str" # Optional. The signed device capability image as a UTF-8 encoded base 64 string. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8707,7 +8721,7 @@ async def generate_capability_image( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.SignedCapabilityImageResponse]] = kwargs.pop("cls", None) + cls: ClsType[_models.SignedCapabilityImageResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -8745,7 +8759,6 @@ async def generate_capability_image( error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} if response.status_code == 200: if _stream: @@ -8756,6 +8769,11 @@ async def generate_capability_image( if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -8835,7 +8853,7 @@ def list_by_catalog( cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8954,7 +8972,7 @@ async def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9010,7 +9028,7 @@ async def _create_or_update_initial( resource: Union[_models.Product, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9452,7 +9470,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9492,8 +9510,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -9501,7 +9519,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def begin_delete( self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ArmOperationStatus]: + ) -> AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. @@ -9512,15 +9530,17 @@ async def begin_delete( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :return: An instance of AsyncLROPoller that returns ArmOperationStatus. The ArmOperationStatus - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of AsyncLROPoller that returns + ArmOperationStatusResourceProvisioningState. The ArmOperationStatusResourceProvisioningState is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -9548,7 +9568,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -9566,7 +9586,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9578,13 +9598,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ArmOperationStatus].from_continuation_token( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ArmOperationStatus]( + return AsyncLROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -9596,7 +9616,7 @@ async def _update_initial( properties: Union[_models.ProductUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9650,8 +9670,8 @@ async def _update_initial( deserialized = _deserialize(JSON, response.json()) if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -9700,7 +9720,7 @@ async def begin_update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -9768,7 +9788,7 @@ async def begin_update( Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -9836,7 +9856,7 @@ async def begin_update( Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -9907,7 +9927,7 @@ async def begin_update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -10055,7 +10075,7 @@ def generate_default_device_groups( cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10147,7 +10167,7 @@ async def count_devices( "value": 0 # Number of children resources in parent resource. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py index e38c2a8bece..73e830ed238 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/__init__.py @@ -6,26 +6,31 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models import ArmOperationStatus +from ._models import ArmOperationStatusResourceProvisioningState from ._models import ArmResource from ._models import ArmResourceBase from ._models import Catalog +from ._models import CatalogListResult from ._models import CatalogProperties from ._models import CatalogUpdate from ._models import Certificate from ._models import CertificateChainResponse +from ._models import CertificateListResult from ._models import CertificateProperties from ._models import ClaimDevicesRequest from ._models import CountDeviceResponse from ._models import CountElementsResponse from ._models import Deployment +from ._models import DeploymentListResult from ._models import DeploymentProperties from ._models import Device from ._models import DeviceGroup +from ._models import DeviceGroupListResult from ._models import DeviceGroupProperties from ._models import DeviceGroupUpdate from ._models import DeviceGroupUpdateProperties from ._models import DeviceInsight +from ._models import DeviceListResult from ._models import DeviceProperties from ._models import DeviceUpdate from ._models import DeviceUpdateProperties @@ -34,11 +39,14 @@ from ._models import ErrorResponse from ._models import GenerateCapabilityImageRequest from ._models import Image +from ._models import ImageListResult from ._models import ImageProperties from ._models import ListDeviceGroupsRequest from ._models import Operation from ._models import OperationDisplay +from ._models import PagedOperation from ._models import Product +from ._models import ProductListResult from ._models import ProductProperties from ._models import ProductUpdate from ._models import ProductUpdateProperties @@ -66,26 +74,31 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ArmOperationStatus", + "ArmOperationStatusResourceProvisioningState", "ArmResource", "ArmResourceBase", "Catalog", + "CatalogListResult", "CatalogProperties", "CatalogUpdate", "Certificate", "CertificateChainResponse", + "CertificateListResult", "CertificateProperties", "ClaimDevicesRequest", "CountDeviceResponse", "CountElementsResponse", "Deployment", + "DeploymentListResult", "DeploymentProperties", "Device", "DeviceGroup", + "DeviceGroupListResult", "DeviceGroupProperties", "DeviceGroupUpdate", "DeviceGroupUpdateProperties", "DeviceInsight", + "DeviceListResult", "DeviceProperties", "DeviceUpdate", "DeviceUpdateProperties", @@ -94,11 +107,14 @@ "ErrorResponse", "GenerateCapabilityImageRequest", "Image", + "ImageListResult", "ImageProperties", "ListDeviceGroupsRequest", "Operation", "OperationDisplay", + "PagedOperation", "Product", + "ProductListResult", "ProductProperties", "ProductUpdate", "ProductUpdateProperties", diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py index ac15127305e..2185eaee7de 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/models/_models.py @@ -18,7 +18,7 @@ from .. import models as _models -class ArmOperationStatus(_model_base.Model): +class ArmOperationStatusResourceProvisioningState(_model_base.Model): # pylint: disable=name-too-long """Standard Azure Resource Manager operation status response. Readonly variables are only populated by the server, and will be ignored when sending a request. @@ -203,6 +203,42 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class CatalogListResult(_model_base.Model): + """The response of a Catalog list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Catalog items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.Catalog] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.Catalog"] = rest_field() + """The Catalog items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.Catalog"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class CatalogProperties(_model_base.Model): """Catalog properties. @@ -325,6 +361,42 @@ class CertificateChainResponse(_model_base.Model): """The certificate chain.""" +class CertificateListResult(_model_base.Model): + """The response of a Certificate list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Certificate items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.Certificate] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.Certificate"] = rest_field() + """The Certificate items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.Certificate"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class CertificateProperties(_model_base.Model): """The properties of certificate. @@ -501,6 +573,42 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class DeploymentListResult(_model_base.Model): + """The response of a Deployment list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Deployment items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.Deployment] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.Deployment"] = rest_field() + """The Deployment items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.Deployment"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class DeploymentProperties(_model_base.Model): """The properties of deployment. @@ -637,6 +745,42 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class DeviceGroupListResult(_model_base.Model): + """The response of a DeviceGroup list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The DeviceGroup items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.DeviceGroup] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.DeviceGroup"] = rest_field() + """The DeviceGroup items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.DeviceGroup"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class DeviceGroupProperties(_model_base.Model): """The properties of deviceGroup. @@ -867,6 +1011,42 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class DeviceListResult(_model_base.Model): + """The response of a Device list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Device items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.Device] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.Device"] = rest_field() + """The Device items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.Device"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class DeviceProperties(_model_base.Model): """The properties of device. @@ -1139,6 +1319,42 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class ImageListResult(_model_base.Model): + """The response of a Image list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Image items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.Image] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.Image"] = rest_field() + """The Image items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.Image"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class ImageProperties(_model_base.Model): """The properties of image. @@ -1363,6 +1579,43 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class PagedOperation(_model_base.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. + + All required parameters must be populated in order to send to server. + + :ivar value: The Operation items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.Operation] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.Operation"] = rest_field() + """The Operation items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.Operation"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class Product(ProxyResourceBase): """An product resource belonging to a catalog resource. @@ -1406,6 +1659,42 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class ProductListResult(_model_base.Model): + """The response of a Product list operation. + + All required parameters must be populated in order to send to server. + + :ivar value: The Product items on this page. Required. + :vartype value: list[~azure.mgmt.spheredpg.models.Product] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + value: List["_models.Product"] = rest_field() + """The Product items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink") + """The link to the next page of items.""" + + @overload + def __init__( + self, + *, + value: List["_models.Product"], + next_link: Optional[str] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class ProductProperties(_model_base.Model): """The properties of product. diff --git a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py index aa932755fef..836deeff67e 100644 --- a/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azure-mgmt-spheredpg/azure/mgmt/spheredpg/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -116,9 +116,9 @@ def build_catalogs_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -147,9 +147,9 @@ def build_catalogs_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) @@ -157,9 +157,12 @@ def build_catalogs_update_request( def build_catalogs_delete_request( resource_group_name: str, catalog_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" # pylint: disable=line-too-long path_format_arguments = { @@ -173,7 +176,10 @@ def build_catalogs_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_catalogs_list_by_resource_group_request( # pylint: disable=name-too-long @@ -429,9 +435,9 @@ def build_catalogs_list_device_groups_request( # pylint: disable=name-too-long _params["$maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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) @@ -534,9 +540,9 @@ def build_images_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -544,9 +550,12 @@ def build_images_create_or_update_request( def build_images_delete_request( resource_group_name: str, catalog_name: str, image_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" # pylint: disable=line-too-long path_format_arguments = { @@ -561,7 +570,10 @@ def build_images_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_device_groups_list_by_product_request( # pylint: disable=name-too-long @@ -676,9 +688,9 @@ def build_device_groups_create_or_update_request( # pylint: disable=name-too-lo _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -691,9 +703,12 @@ def build_device_groups_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" # pylint: disable=line-too-long path_format_arguments = { @@ -709,7 +724,10 @@ def build_device_groups_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_device_groups_update_request( @@ -743,9 +761,9 @@ def build_device_groups_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) @@ -798,6 +816,8 @@ def build_device_groups_claim_devices_request( # pylint: disable=name-too-long content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" # pylint: disable=line-too-long path_format_arguments = { @@ -816,6 +836,7 @@ def build_device_groups_claim_devices_request( # pylint: disable=name-too-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="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -947,9 +968,9 @@ def build_certificates_retrieve_proof_of_possession_nonce_request( # pylint: di _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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) @@ -1072,9 +1093,9 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -1088,9 +1109,12 @@ def build_deployments_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" # pylint: disable=line-too-long path_format_arguments = { @@ -1107,7 +1131,10 @@ def build_deployments_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_devices_get_request( @@ -1180,9 +1207,9 @@ def build_devices_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -1231,9 +1258,12 @@ def build_devices_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" # pylint: disable=line-too-long path_format_arguments = { @@ -1250,7 +1280,10 @@ def build_devices_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_devices_update_request( @@ -1286,9 +1319,9 @@ def build_devices_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) @@ -1326,9 +1359,9 @@ def build_devices_generate_capability_image_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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) @@ -1415,9 +1448,9 @@ def build_products_create_or_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -1425,9 +1458,12 @@ def build_products_create_or_update_request( def build_products_delete_request( resource_group_name: str, catalog_name: str, product_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" # pylint: disable=line-too-long path_format_arguments = { @@ -1442,7 +1478,10 @@ def build_products_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_products_update_request( @@ -1470,9 +1509,9 @@ def build_products_update_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) @@ -1597,7 +1636,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1786,7 @@ def get(self, resource_group_name: str, catalog_name: str, **kwargs: Any) -> _mo } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1801,7 +1840,7 @@ def _create_or_update_initial( resource: Union[_models.Catalog, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2513,7 +2552,7 @@ def update( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2573,7 +2612,7 @@ def update( def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2612,8 +2651,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -2621,7 +2660,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete( self, resource_group_name: str, catalog_name: str, **kwargs: Any - ) -> LROPoller[_models.ArmOperationStatus]: + ) -> LROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Catalog. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2629,15 +2668,16 @@ def begin_delete( :type resource_group_name: str :param catalog_name: Name of catalog. Required. :type catalog_name: str - :return: An instance of LROPoller that returns ArmOperationStatus. The ArmOperationStatus is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of LROPoller that returns ArmOperationStatusResourceProvisioningState. The + ArmOperationStatusResourceProvisioningState is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -2665,7 +2705,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -2682,7 +2722,7 @@ def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -2694,13 +2734,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ArmOperationStatus].from_continuation_token( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ArmOperationStatus]( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -2759,7 +2799,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite cls: ClsType[List[_models.Catalog]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2875,7 +2915,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Catalog"]: cls: ClsType[List[_models.Catalog]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2959,7 +2999,7 @@ def count_devices(self, resource_group_name: str, catalog_name: str, **kwargs: A "value": 0 # Number of children resources in parent resource. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3056,7 +3096,7 @@ def list_device_insights( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.DeviceInsight]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3204,7 +3244,7 @@ def list_devices( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3400,7 +3440,7 @@ def list_deployments( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3814,7 +3854,7 @@ def list_device_groups( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3975,7 +4015,7 @@ def get(self, resource_group_name: str, catalog_name: str, image_name: str, **kw } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4108,7 +4148,7 @@ def list_by_catalog( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Image]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4185,7 +4225,7 @@ def _create_or_update_initial( resource: Union[_models.Image, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4713,7 +4753,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4753,8 +4793,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -4762,7 +4802,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete( self, resource_group_name: str, catalog_name: str, image_name: str, **kwargs: Any - ) -> LROPoller[_models.ArmOperationStatus]: + ) -> LROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Image. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -4772,15 +4812,16 @@ def begin_delete( :type catalog_name: str :param image_name: Image name. Use .default for image creation. Required. :type image_name: str - :return: An instance of LROPoller that returns ArmOperationStatus. The ArmOperationStatus is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of LROPoller that returns ArmOperationStatusResourceProvisioningState. The + ArmOperationStatusResourceProvisioningState is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -4808,7 +4849,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -4826,7 +4867,7 @@ def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4838,13 +4879,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ArmOperationStatus].from_continuation_token( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ArmOperationStatus]( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -4951,7 +4992,7 @@ def list_by_product( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5088,7 +5129,7 @@ def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5146,7 +5187,7 @@ def _create_or_update_initial( resource: Union[_models.DeviceGroup, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5668,7 +5709,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5709,8 +5750,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -5718,7 +5759,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete( self, resource_group_name: str, catalog_name: str, product_name: str, device_group_name: str, **kwargs: Any - ) -> LROPoller[_models.ArmOperationStatus]: + ) -> LROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. @@ -5731,15 +5772,16 @@ def begin_delete( :type product_name: str :param device_group_name: Name of device group. Required. :type device_group_name: str - :return: An instance of LROPoller that returns ArmOperationStatus. The ArmOperationStatus is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of LROPoller that returns ArmOperationStatusResourceProvisioningState. The + ArmOperationStatusResourceProvisioningState is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -5767,7 +5809,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -5786,7 +5828,7 @@ def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5798,13 +5840,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ArmOperationStatus].from_continuation_token( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ArmOperationStatus]( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -5817,7 +5859,7 @@ def _update_initial( properties: Union[_models.DeviceGroupUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5872,8 +5914,8 @@ def _update_initial( deserialized = _deserialize(JSON, response.json()) if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -5934,7 +5976,7 @@ def begin_update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -6016,7 +6058,7 @@ def begin_update( Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -6098,7 +6140,7 @@ def begin_update( Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -6192,7 +6234,7 @@ def begin_update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -6310,7 +6352,7 @@ def count_devices( "value": 0 # Number of children resources in parent resource. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6511,7 +6553,7 @@ def claim_devices( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6647,7 +6689,7 @@ def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6774,7 +6816,7 @@ def list_by_catalog( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Certificate]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6870,7 +6912,7 @@ def retrieve_cert_chain( "certificateChain": "str" # Optional. The certificate chain. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7132,7 +7174,7 @@ def retrieve_proof_of_possession_nonce( "thumbprint": "str" # Optional. The certificate thumbprint. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7330,7 +7372,7 @@ def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7514,7 +7556,7 @@ def list_by_device_group( maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7595,7 +7637,7 @@ def _create_or_update_initial( resource: Union[_models.Deployment, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8417,7 +8459,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements deployment_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8459,8 +8501,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -8474,7 +8516,7 @@ def begin_delete( device_group_name: str, deployment_name: str, **kwargs: Any - ) -> LROPoller[_models.ArmOperationStatus]: + ) -> LROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device group name. @@ -8490,15 +8532,16 @@ def begin_delete( :param deployment_name: Deployment name. Use .default for deployment creation and to get the current deployment for the associated device group. Required. :type deployment_name: str - :return: An instance of LROPoller that returns ArmOperationStatus. The ArmOperationStatus is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of LROPoller that returns ArmOperationStatusResourceProvisioningState. The + ArmOperationStatusResourceProvisioningState is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -8526,7 +8569,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -8546,7 +8589,7 @@ def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8558,13 +8601,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ArmOperationStatus].from_continuation_token( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ArmOperationStatus]( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -8659,7 +8702,7 @@ def get( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8719,7 +8762,7 @@ def _create_or_update_initial( resource: Union[_models.Device, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9310,7 +9353,7 @@ def list_by_device_group( cls: ClsType[List[_models.Device]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9386,7 +9429,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements device_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9428,8 +9471,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -9443,7 +9486,7 @@ def begin_delete( device_group_name: str, device_name: str, **kwargs: Any - ) -> LROPoller[_models.ArmOperationStatus]: + ) -> LROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Device. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -9457,15 +9500,16 @@ def begin_delete( :type device_group_name: str :param device_name: Device name. Required. :type device_name: str - :return: An instance of LROPoller that returns ArmOperationStatus. The ArmOperationStatus is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of LROPoller that returns ArmOperationStatusResourceProvisioningState. The + ArmOperationStatusResourceProvisioningState is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -9493,7 +9537,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -9513,7 +9557,7 @@ def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9525,13 +9569,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ArmOperationStatus].from_continuation_token( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ArmOperationStatus]( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -9547,7 +9591,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.Device]: + ) -> _models.Device: # pylint: disable=line-too-long """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. @@ -9568,8 +9612,8 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Device or None. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device or None + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -9582,7 +9626,7 @@ def update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -9636,7 +9680,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.Device]: + ) -> _models.Device: # pylint: disable=line-too-long """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. @@ -9657,14 +9701,14 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: Device or None. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device or None + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -9718,7 +9762,7 @@ def update( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.Device]: + ) -> _models.Device: # pylint: disable=line-too-long """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. @@ -9739,14 +9783,14 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: Device or None. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device or None + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -9798,7 +9842,7 @@ def update( device_name: str, properties: Union[_models.DeviceUpdate, JSON, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Device]: + ) -> _models.Device: # pylint: disable=line-too-long """Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the catalog level. @@ -9817,8 +9861,8 @@ def update( :param properties: The resource properties to be updated. Is one of the following types: DeviceUpdate, JSON, IO[bytes] Required. :type properties: ~azure.mgmt.spheredpg.models.DeviceUpdate or JSON or IO[bytes] - :return: Device or None. The Device is compatible with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.Device or None + :return: Device. The Device is compatible with MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.Device :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -9831,7 +9875,7 @@ def update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -9872,7 +9916,7 @@ def update( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -9884,7 +9928,7 @@ def update( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.Device]] = kwargs.pop("cls", None) + cls: ClsType[_models.Device] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -9922,7 +9966,6 @@ def update( error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} if response.status_code == 200: if _stream: @@ -9933,6 +9976,11 @@ def update( if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Device, response.json()) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -9950,7 +9998,7 @@ def generate_capability_image( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.SignedCapabilityImageResponse]: + ) -> _models.SignedCapabilityImageResponse: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. @@ -9971,9 +10019,9 @@ def generate_capability_image( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse or None. The SignedCapabilityImageResponse is compatible - with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse or None + :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -9986,7 +10034,7 @@ def generate_capability_image( ] } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "image": "str" # Optional. The signed device capability image as a UTF-8 encoded base 64 string. @@ -10005,7 +10053,7 @@ def generate_capability_image( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.SignedCapabilityImageResponse]: + ) -> _models.SignedCapabilityImageResponse: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. @@ -10026,15 +10074,15 @@ def generate_capability_image( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse or None. The SignedCapabilityImageResponse is compatible - with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse or None + :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "image": "str" # Optional. The signed device capability image as a UTF-8 encoded base 64 string. @@ -10053,7 +10101,7 @@ def generate_capability_image( *, content_type: str = "application/json", **kwargs: Any - ) -> Optional[_models.SignedCapabilityImageResponse]: + ) -> _models.SignedCapabilityImageResponse: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. @@ -10074,15 +10122,15 @@ def generate_capability_image( :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: SignedCapabilityImageResponse or None. The SignedCapabilityImageResponse is compatible - with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse or None + :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "image": "str" # Optional. The signed device capability image as a UTF-8 encoded base 64 string. @@ -10099,7 +10147,7 @@ def generate_capability_image( device_name: str, parameters: Union[_models.GenerateCapabilityImageRequest, JSON, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SignedCapabilityImageResponse]: + ) -> _models.SignedCapabilityImageResponse: """Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product names to generate the image for a device that does not belong to a specific device group and product. @@ -10119,9 +10167,9 @@ def generate_capability_image( GenerateCapabilityImageRequest, JSON, IO[bytes] Required. :type parameters: ~azure.mgmt.spheredpg.models.GenerateCapabilityImageRequest or JSON or IO[bytes] - :return: SignedCapabilityImageResponse or None. The SignedCapabilityImageResponse is compatible - with MutableMapping - :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse or None + :return: SignedCapabilityImageResponse. The SignedCapabilityImageResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.spheredpg.models.SignedCapabilityImageResponse :raises ~azure.core.exceptions.HttpResponseError: Example: @@ -10134,13 +10182,13 @@ def generate_capability_image( ] } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "image": "str" # Optional. The signed device capability image as a UTF-8 encoded base 64 string. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10152,7 +10200,7 @@ def generate_capability_image( _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.SignedCapabilityImageResponse]] = kwargs.pop("cls", None) + cls: ClsType[_models.SignedCapabilityImageResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _content = None @@ -10190,7 +10238,6 @@ def generate_capability_image( error = _deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None response_headers = {} if response.status_code == 200: if _stream: @@ -10201,6 +10248,11 @@ def generate_capability_image( if response.status_code == 202: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.SignedCapabilityImageResponse, response.json()) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -10280,7 +10332,7 @@ def list_by_catalog( cls: ClsType[List[_models.Product]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10397,7 +10449,7 @@ def get(self, resource_group_name: str, catalog_name: str, product_name: str, ** } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10453,7 +10505,7 @@ def _create_or_update_initial( resource: Union[_models.Product, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10895,7 +10947,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -10935,8 +10987,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -10944,7 +10996,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements @distributed_trace def begin_delete( self, resource_group_name: str, catalog_name: str, product_name: str, **kwargs: Any - ) -> LROPoller[_models.ArmOperationStatus]: + ) -> LROPoller[_models.ArmOperationStatusResourceProvisioningState]: """Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. @@ -10955,15 +11007,16 @@ def begin_delete( :type catalog_name: str :param product_name: Name of product. Required. :type product_name: str - :return: An instance of LROPoller that returns ArmOperationStatus. The ArmOperationStatus is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatus] + :return: An instance of LROPoller that returns ArmOperationStatusResourceProvisioningState. The + ArmOperationStatusResourceProvisioningState is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.spheredpg.models.ArmOperationStatusResourceProvisioningState] :raises ~azure.core.exceptions.HttpResponseError: Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202, 204 response == { "status": "str", # The operation status. Required. Known values are: "Succeeded", "Failed", and "Canceled". @@ -10991,7 +11044,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ArmOperationStatus] = kwargs.pop("cls", None) + cls: ClsType[_models.ArmOperationStatusResourceProvisioningState] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) @@ -11009,7 +11062,7 @@ def begin_delete( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ArmOperationStatus, response.json()) + deserialized = _deserialize(_models.ArmOperationStatusResourceProvisioningState, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11021,13 +11074,13 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ArmOperationStatus].from_continuation_token( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ArmOperationStatus]( + return LROPoller[_models.ArmOperationStatusResourceProvisioningState]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -11039,7 +11092,7 @@ def _update_initial( properties: Union[_models.ProductUpdate, JSON, IO[bytes]], **kwargs: Any ) -> Optional[JSON]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11093,8 +11146,8 @@ def _update_initial( deserialized = _deserialize(JSON, response.json()) if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -11143,7 +11196,7 @@ def begin_update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -11211,7 +11264,7 @@ def begin_update( Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -11279,7 +11332,7 @@ def begin_update( Example: .. code-block:: python - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -11350,7 +11403,7 @@ def begin_update( } } - # response body for status code(s): 200 + # response body for status code(s): 200, 202 response == { "id": "str", # Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -11498,7 +11551,7 @@ def generate_default_device_groups( cls: ClsType[List[_models.DeviceGroup]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -11590,7 +11643,7 @@ def count_devices( "value": 0 # Number of children resources in parent resource. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/README.md b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/README.md index efd65bace1a..05cd95edd34 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/README.md +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install azurecore-lro-rpc diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/_operations/_operations.py index 9049752ed17..06ec31edb47 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -58,16 +58,16 @@ def build_rpc_long_running_rpc_request(**kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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) class RpcClientOperationsMixin(RpcClientMixinABC): def _long_running_rpc_initial(self, body: Union[_models.GenerationOptions, JSON, IO[bytes]], **kwargs: Any) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/aio/_operations/_operations.py index bb34b8b574f..50aa64c1625 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -44,7 +44,7 @@ class RpcClientOperationsMixin(RpcClientMixinABC): async def _long_running_rpc_initial( self, body: Union[_models.GenerationOptions, JSON, IO[bytes]], **kwargs: Any ) -> JSON: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/__init__.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/__init__.py index 6494ebacb61..c2b9d1238d6 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/__init__.py @@ -6,15 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models import Error from ._models import GenerationOptions +from ._models import GenerationResponse from ._models import GenerationResult +from ._models import InnerError + +from ._enums import OperationState from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Error", "GenerationOptions", + "GenerationResponse", "GenerationResult", + "InnerError", + "OperationState", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/_enums.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/_enums.py similarity index 50% rename from packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/_enums.py rename to packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/_enums.py index 56d345a4e74..ee68da0a3e6 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/_enums.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/_enums.py @@ -10,22 +10,16 @@ from azure.core import CaseInsensitiveEnumMeta -class UnionFloatLiteralPropertyProperty(float, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionFloatLiteralPropertyProperty.""" - - ENUM_1_2 = 1.2 - ENUM_2_3 = 2.3 - - -class UnionIntLiteralPropertyProperty(int, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionIntLiteralPropertyProperty.""" - - ENUM_1 = 1 - ENUM_2 = 2 - - -class UnionStringLiteralPropertyProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionStringLiteralPropertyProperty.""" - - HELLO = "hello" - WORLD = "world" +class OperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum describing allowed operation states.""" + + NOT_STARTED = "NotStarted" + """The operation has not started.""" + RUNNING = "Running" + """The operation is in progress.""" + SUCCEEDED = "Succeeded" + """The operation has completed successfully.""" + FAILED = "Failed" + """The operation has failed.""" + CANCELED = "Canceled" + """The operation has been canceled by the user.""" diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/_models.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/_models.py index 1fe634aa2b3..e2fcb743056 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/_models.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpc/azurecore/lro/rpc/models/_models.py @@ -7,11 +7,67 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Mapping, overload +from typing import Any, List, Mapping, Optional, TYPE_CHECKING, Union, overload from .. import _model_base from .._model_base import rest_field +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + + +class Error(_model_base.Model): + """The error object. + + All required parameters must be populated in order to send to server. + + :ivar code: One of a server-defined set of error codes. Required. + :vartype code: str + :ivar message: A human-readable representation of the error. Required. + :vartype message: str + :ivar target: The target of the error. + :vartype target: str + :ivar details: An array of details about specific errors that led to this reported error. + :vartype details: list[~azurecore.lro.rpc.models.Error] + :ivar innererror: An object containing more specific information than the current object about + the error. + :vartype innererror: ~azurecore.lro.rpc.models.InnerError + """ + + code: str = rest_field() + """One of a server-defined set of error codes. Required.""" + message: str = rest_field() + """A human-readable representation of the error. Required.""" + target: Optional[str] = rest_field() + """The target of the error.""" + details: Optional[List["_models.Error"]] = rest_field() + """An array of details about specific errors that led to this reported error.""" + innererror: Optional["_models.InnerError"] = rest_field() + """An object containing more specific information than the current object about the error.""" + + @overload + def __init__( + self, + *, + code: str, + message: str, + target: Optional[str] = None, + details: Optional[List["_models.Error"]] = None, + innererror: Optional["_models.InnerError"] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + class GenerationOptions(_model_base.Model): """Options for the generation. @@ -44,6 +100,55 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class GenerationResponse(_model_base.Model): + """Provides status details for long running operations. + + Readonly variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: The unique ID of the operation. Required. + :vartype id: str + :ivar status: The status of the operation. Required. Known values are: "NotStarted", "Running", + "Succeeded", "Failed", and "Canceled". + :vartype status: str or ~azurecore.lro.rpc.models.OperationState + :ivar error: Error object that describes the error when status is "Failed". + :vartype error: ~azurecore.lro.rpc.models.Error + :ivar result: The result of the operation. + :vartype result: ~azurecore.lro.rpc.models.GenerationResult + """ + + id: str = rest_field(visibility=["read"]) + """The unique ID of the operation. Required.""" + status: Union[str, "_models.OperationState"] = rest_field() + """The status of the operation. Required. Known values are: \"NotStarted\", \"Running\", + \"Succeeded\", \"Failed\", and \"Canceled\".""" + error: Optional["_models.Error"] = rest_field() + """Error object that describes the error when status is \"Failed\".""" + result: Optional["_models.GenerationResult"] = rest_field() + """The result of the operation.""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.OperationState"], + error: Optional["_models.Error"] = None, + result: Optional["_models.GenerationResult"] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class GenerationResult(_model_base.Model): """Result of the generation. @@ -73,3 +178,39 @@ def __init__(self, mapping: Mapping[str, Any]): def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation super().__init__(*args, **kwargs) + + +class InnerError(_model_base.Model): + """An object containing more specific information about the error. As per Microsoft One API + guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :ivar code: One of a server-defined set of error codes. + :vartype code: str + :ivar innererror: Inner error. + :vartype innererror: ~azurecore.lro.rpc.models.InnerError + """ + + code: Optional[str] = rest_field() + """One of a server-defined set of error codes.""" + innererror: Optional["_models.InnerError"] = rest_field() + """Inner error.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + innererror: Optional["_models.InnerError"] = None, + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/README.md b/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/README.md index 5880dd3cbcd..6866dfa0a3a 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/README.md +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install azurecore-lro-rpclegacy diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/azurecore/lro/rpclegacy/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/azurecore/lro/rpclegacy/aio/operations/_operations.py index d41f83cfc78..c1d64b5ae58 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/azurecore/lro/rpclegacy/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/azurecore/lro/rpclegacy/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -104,7 +104,7 @@ async def get_job(self, job_id: str, **kwargs: Any) -> _models.JobResult: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,7 +151,7 @@ async def get_job(self, job_id: str, **kwargs: Any) -> _models.JobResult: async def _create_job_initial( # pylint: disable=inconsistent-return-statements self, body: Union[_models.JobData, JSON, IO[bytes]], **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/azurecore/lro/rpclegacy/operations/_operations.py b/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/azurecore/lro/rpclegacy/operations/_operations.py index 8f97d662fe8..19c62e26deb 100644 --- a/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/azurecore/lro/rpclegacy/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/azurecore-lro-rpclegacy/azurecore/lro/rpclegacy/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -76,6 +76,8 @@ def build_create_resource_poll_via_operation_location_create_job_request( # pyl content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/azure/core/lro/rpc/legacy/create-resource-poll-via-operation-location/jobs" @@ -85,6 +87,7 @@ def build_create_resource_poll_via_operation_location_create_job_request( # pyl # Construct headers if content_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) @@ -151,7 +154,7 @@ def get_job(self, job_id: str, **kwargs: Any) -> _models.JobResult: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +201,7 @@ def get_job(self, job_id: str, **kwargs: Any) -> _models.JobResult: def _create_job_initial( # pylint: disable=inconsistent-return-statements self, body: Union[_models.JobData, JSON, IO[bytes]], **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/client-naming/README.md b/packages/typespec-python/test/azure/generated/client-naming/README.md index c959dcb6840..622cac7dd9f 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/README.md +++ b/packages/typespec-python/test/azure/generated/client-naming/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install client-naming diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/_client.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/_client.py index 7449bb9ec94..64736889079 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/_client.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/_client.py @@ -15,7 +15,7 @@ from ._configuration import NamingClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import ModelOperations, NamingClientOperationsMixin +from .operations import ModelOperations, NamingClientOperationsMixin, UnionEnumOperations class NamingClient(NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword @@ -23,6 +23,8 @@ class NamingClient(NamingClientOperationsMixin): # pylint: disable=client-accep :ivar model: ModelOperations operations :vartype model: client.naming.operations.ModelOperations + :ivar union_enum: UnionEnumOperations operations + :vartype union_enum: client.naming.operations.UnionEnumOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -54,6 +56,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._deserialize = Deserializer() self._serialize.client_side_validation = False self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) + self.union_enum = UnionEnumOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/_client.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/_client.py index bf8824f2d0b..99500d40636 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/_client.py @@ -15,7 +15,7 @@ from .._serialization import Deserializer, Serializer from ._configuration import NamingClientConfiguration -from .operations import ModelOperations, NamingClientOperationsMixin +from .operations import ModelOperations, NamingClientOperationsMixin, UnionEnumOperations class NamingClient(NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword @@ -23,6 +23,8 @@ class NamingClient(NamingClientOperationsMixin): # pylint: disable=client-accep :ivar model: ModelOperations operations :vartype model: client.naming.aio.operations.ModelOperations + :ivar union_enum: UnionEnumOperations operations + :vartype union_enum: client.naming.aio.operations.UnionEnumOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -54,6 +56,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._deserialize = Deserializer() self._serialize.client_side_validation = False self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) + self.union_enum = UnionEnumOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/__init__.py index ce97526d278..240b29b4619 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/__init__.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from ._operations import ModelOperations +from ._operations import UnionEnumOperations from ._operations import NamingClientOperationsMixin from ._patch import __all__ as _patch_all @@ -15,6 +16,7 @@ __all__ = [ "ModelOperations", + "UnionEnumOperations", "NamingClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/_operations.py index dab5ec4e033..0f58d896cba 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -36,6 +36,8 @@ build_naming_parameter_request, build_naming_request_request, build_naming_response_request, + build_union_enum_union_enum_member_name_request, + build_union_enum_union_enum_name_request, ) from .._vendor import NamingClientMixinABC @@ -141,7 +143,7 @@ async def client( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +264,7 @@ async def language( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,6 +310,128 @@ async def language( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore +class UnionEnumOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~client.naming.aio.NamingClient`'s + :attr:`union_enum` attribute. + """ + + 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 union_enum_name( # pylint: disable=inconsistent-return-statements + self, body: Union[str, _models.ClientExtensibleEnum], **kwargs: Any + ) -> None: + """union_enum_name. + + :param body: "value1" Required. + :type body: str or ~client.naming.models.ClientExtensibleEnum + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_union_enum_name_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def union_enum_member_name( # pylint: disable=inconsistent-return-statements + self, body: Union[str, _models.ExtensibleEnum], **kwargs: Any + ) -> None: + """union_enum_member_name. + + :param body: Known values are: "value1" and "value2". Required. + :type body: str or ~client.naming.models.ExtensibleEnum + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_union_enum_member_name_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + class NamingClientOperationsMixin(NamingClientMixinABC): @distributed_trace_async async def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -317,7 +441,7 @@ async def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +488,7 @@ async def parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -476,7 +600,7 @@ async def client( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +721,7 @@ async def language( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -719,7 +843,7 @@ async def compatible_with_encoded_name( # pylint: disable=inconsistent-return-s "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -776,7 +900,7 @@ async def request( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -820,7 +944,7 @@ async def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/models/__init__.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/models/__init__.py index af944ef3b1e..04f7d57de1d 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/models/__init__.py @@ -11,6 +11,9 @@ from ._models import ClientNameModel from ._models import LanguageClientNameModel from ._models import PythonModel + +from ._enums import ClientExtensibleEnum +from ._enums import ExtensibleEnum from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -21,6 +24,8 @@ "ClientNameModel", "LanguageClientNameModel", "PythonModel", + "ClientExtensibleEnum", + "ExtensibleEnum", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/models/_enums.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/models/_enums.py new file mode 100644 index 00000000000..f9715a7ef73 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/models/_enums.py @@ -0,0 +1,23 @@ +# 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) Python 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 ClientExtensibleEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ClientExtensibleEnum.""" + + ENUM_VALUE1 = "value1" + + +class ExtensibleEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ExtensibleEnum.""" + + CLIENT_ENUM_VALUE1 = "value1" + CLIENT_ENUM_VALUE2 = "value2" diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/__init__.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/__init__.py index ce97526d278..240b29b4619 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/__init__.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from ._operations import ModelOperations +from ._operations import UnionEnumOperations from ._operations import NamingClientOperationsMixin from ._patch import __all__ as _patch_all @@ -15,6 +16,7 @@ __all__ = [ "ModelOperations", + "UnionEnumOperations", "NamingClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/_operations.py index 71eff711282..0f108089cec 100644 --- a/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-naming/client/naming/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -69,6 +69,32 @@ def build_model_language_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) +def build_union_enum_union_enum_name_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/client/naming/union-enum/union-enum-name" + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_union_enum_union_enum_member_name_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/client/naming/union-enum/union-enum-member-name" + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + def build_naming_client_name_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = "/client/naming/operation" @@ -242,7 +268,7 @@ def client( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +389,7 @@ def language( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,6 +435,128 @@ def language( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore +class UnionEnumOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~client.naming.NamingClient`'s + :attr:`union_enum` attribute. + """ + + 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 union_enum_name( # pylint: disable=inconsistent-return-statements + self, body: Union[str, _models.ClientExtensibleEnum], **kwargs: Any + ) -> None: + """union_enum_name. + + :param body: "value1" Required. + :type body: str or ~client.naming.models.ClientExtensibleEnum + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_union_enum_name_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def union_enum_member_name( # pylint: disable=inconsistent-return-statements + self, body: Union[str, _models.ExtensibleEnum], **kwargs: Any + ) -> None: + """union_enum_member_name. + + :param body: Known values are: "value1" and "value2". Required. + :type body: str or ~client.naming.models.ExtensibleEnum + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_union_enum_member_name_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + class NamingClientOperationsMixin(NamingClientMixinABC): @distributed_trace def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements @@ -418,7 +566,7 @@ def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,7 +611,7 @@ def parameter(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,7 +723,7 @@ def client( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -696,7 +844,7 @@ def language( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -818,7 +966,7 @@ def compatible_with_encoded_name( # pylint: disable=inconsistent-return-stateme "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -873,7 +1021,7 @@ def request(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -917,7 +1065,7 @@ def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/README.md b/packages/typespec-python/test/azure/generated/client-structure-default/README.md index 7713ef9d554..6779c61e802 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/README.md +++ b/packages/typespec-python/test/azure/generated/client-structure-default/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install client-structure-service diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/_client.py b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/_client.py index b003ee80661..1a4284fa9c9 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/_client.py +++ b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/_client.py @@ -100,7 +100,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/_client.py b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/_client.py index 7e611832547..d4ed3374b65 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/_client.py @@ -102,7 +102,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/operations/_operations.py index df9fe8bf073..425ed5c09f7 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ ) from .._vendor import ServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ async def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +108,7 @@ async def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -149,7 +154,7 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +173,7 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -196,7 +201,7 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +220,7 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -261,7 +266,7 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,7 +285,7 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -308,7 +313,7 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,7 +332,7 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -357,7 +362,7 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -376,7 +381,7 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -404,7 +409,7 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +428,7 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -469,7 +474,7 @@ async def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +493,7 @@ async def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -534,7 +539,7 @@ async def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -553,7 +558,7 @@ async def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/operations/_operations.py index cc3876d26cb..f737e67dc8a 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-default/client/structure/service/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import ServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -140,7 +145,7 @@ def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -205,7 +210,7 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +229,7 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -252,7 +257,7 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +276,7 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -317,7 +322,7 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,7 +341,7 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -364,7 +369,7 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +388,7 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -413,7 +418,7 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +437,7 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -460,7 +465,7 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -479,7 +484,7 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -525,7 +530,7 @@ def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +549,7 @@ def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -590,7 +595,7 @@ def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -609,7 +614,7 @@ def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/README.md b/packages/typespec-python/test/azure/generated/client-structure-multiclient/README.md index cc0c12c4a0b..035a5f541c0 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/README.md +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install client-structure-multiclient diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_client.py b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_client.py index c3a2c1eb6b3..26707f2bcf1 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_client.py +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_client.py @@ -79,7 +79,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) @@ -156,7 +156,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py index 5b6aa7d1653..6dbda94810d 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import ClientAClientMixinABC, ClientBClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,7 +105,7 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -128,7 +133,7 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +152,7 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -175,7 +180,7 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,7 +199,7 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -224,7 +229,7 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +248,7 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -271,7 +276,7 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -290,7 +295,7 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -318,7 +323,7 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,7 +342,7 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_client.py b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_client.py index d9efb98bff3..d86281c0e58 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_client.py @@ -81,7 +81,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) @@ -160,7 +160,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py index b0756240d88..c599c8be055 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ ) from .._vendor import ClientAClientMixinABC, ClientBClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -62,7 +67,7 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -90,7 +95,7 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -137,7 +142,7 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -156,7 +161,7 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -186,7 +191,7 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +210,7 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -233,7 +238,7 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,7 +257,7 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -280,7 +285,7 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +304,7 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/README.md b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/README.md index ca06ce1b863..ed5e29b0a6a 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/README.md +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install client-structure-renamedoperation diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/_client.py b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/_client.py index 7cf6b56afdf..6bac460860c 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/_client.py +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/_client.py @@ -84,7 +84,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py index 75105a94102..e96617437d5 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py @@ -86,7 +86,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py index 255e5cacb17..41a35c98a24 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ ) from .._vendor import RenamedOperationClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,7 +83,7 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -106,7 +111,7 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,7 +130,7 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -153,7 +158,7 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -172,7 +177,7 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -202,7 +207,7 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +226,7 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -249,7 +254,7 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,7 +273,7 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -296,7 +301,7 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +320,7 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py index dafa0f0f12d..6f7084e6950 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import RenamedOperationClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +102,7 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -116,7 +121,7 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -144,7 +149,7 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +168,7 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -191,7 +196,7 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +215,7 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -240,7 +245,7 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +264,7 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -287,7 +292,7 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -306,7 +311,7 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -334,7 +339,7 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +358,7 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/README.md b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/README.md index d3bb88faf32..f721cf35cf3 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/README.md +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install client-structure-twooperationgroup diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py index 9b68493fbe5..3a57a606fed 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py @@ -85,7 +85,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py index 59e79e98b19..1ce29b4f4dc 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py @@ -87,7 +87,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py index c865426deee..a345091102a 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_group2_two_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -77,7 +82,7 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -105,7 +110,7 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -124,7 +129,7 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -152,7 +157,7 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +176,7 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -217,7 +222,7 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -236,7 +241,7 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -264,7 +269,7 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,7 +288,7 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -311,7 +316,7 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -330,7 +335,7 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py index eb3d1038c4d..697e3b5e58f 100644 --- a/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +101,7 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +120,7 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -143,7 +148,7 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +167,7 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -190,7 +195,7 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -255,7 +260,7 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +279,7 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -302,7 +307,7 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +326,7 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -349,7 +354,7 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +373,7 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/README.md b/packages/typespec-python/test/azure/generated/encode-bytes/README.md index ab0170134a6..3fe91d2d5e5 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/README.md +++ b/packages/typespec-python/test/azure/generated/encode-bytes/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install encode-bytes diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py index 9d319ed9aa4..afabbefbc4c 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -87,7 +87,7 @@ async def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,7 +133,7 @@ async def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,7 +179,7 @@ async def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +227,7 @@ async def base64url_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +383,7 @@ async def default( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +537,7 @@ async def base64( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -691,7 +691,7 @@ async def base64url( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -862,7 +862,7 @@ async def base64url_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -942,7 +942,7 @@ async def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -988,7 +988,7 @@ async def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1034,7 +1034,7 @@ async def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1082,7 +1082,7 @@ async def base64url_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1146,7 +1146,7 @@ async def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1196,7 +1196,7 @@ async def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1248,7 +1248,7 @@ async def custom_content_type( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1298,7 +1298,7 @@ async def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1348,7 +1348,7 @@ async def base64url(self, value: bytes, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1414,7 +1414,7 @@ async def default(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1464,7 +1464,7 @@ async def octet_stream(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1511,7 +1511,7 @@ async def custom_content_type(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1558,7 +1558,7 @@ async def base64(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1608,7 +1608,7 @@ async def base64url(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py index 9c05c0a9f3b..d3471cc12b5 100644 --- a/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-bytes/encode/bytes/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Iterator, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterator, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -98,9 +98,9 @@ def build_property_default_request(**kwargs: Any) -> HttpRequest: _url = "/encode/bytes/property/default" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -115,9 +115,9 @@ def build_property_base64_request(**kwargs: Any) -> HttpRequest: _url = "/encode/bytes/property/base64" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -132,9 +132,9 @@ def build_property_base64url_request(**kwargs: Any) -> HttpRequest: _url = "/encode/bytes/property/base64url" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -149,9 +149,9 @@ def build_property_base64url_array_request(**kwargs: Any) -> HttpRequest: _url = "/encode/bytes/property/base64url-array" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -207,13 +207,12 @@ def build_header_base64url_array_request(*, value: List[bytes], **kwargs: Any) - def build_request_body_default_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/encode/bytes/body/request/default" # 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) @@ -247,13 +246,12 @@ def build_request_body_custom_content_type_request(**kwargs: Any) -> HttpRequest def build_request_body_base64_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/encode/bytes/body/request/base64" # 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) @@ -261,13 +259,12 @@ def build_request_body_base64_request(**kwargs: Any) -> HttpRequest: def build_request_body_base64url_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/encode/bytes/body/request/base64url" # 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) @@ -369,7 +366,7 @@ def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +412,7 @@ def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,7 +458,7 @@ def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -509,7 +506,7 @@ def base64url_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -665,7 +662,7 @@ def default( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -819,7 +816,7 @@ def base64( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -973,7 +970,7 @@ def base64url( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1144,7 +1141,7 @@ def base64url_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1224,7 +1221,7 @@ def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1270,7 +1267,7 @@ def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1316,7 +1313,7 @@ def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1364,7 +1361,7 @@ def base64url_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1428,7 +1425,7 @@ def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1478,7 +1475,7 @@ def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1530,7 +1527,7 @@ def custom_content_type( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1580,7 +1577,7 @@ def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1630,7 +1627,7 @@ def base64url(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1696,7 +1693,7 @@ def default(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1746,7 +1743,7 @@ def octet_stream(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1793,7 +1790,7 @@ def custom_content_type(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1840,7 +1837,7 @@ def base64(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1890,7 +1887,7 @@ def base64url(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/README.md b/packages/typespec-python/test/azure/generated/encode-datetime/README.md index 67e0598a3b1..d278743310d 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/README.md +++ b/packages/typespec-python/test/azure/generated/encode-datetime/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install encode-datetime diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py index 55b755cb3ac..d1a52676743 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/aio/operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -87,7 +87,7 @@ async def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +135,7 @@ async def rfc3339( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -183,7 +183,7 @@ async def rfc7231( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +231,7 @@ async def unix_timestamp( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -279,7 +279,7 @@ async def unix_timestamp_array( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +435,7 @@ async def default( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +589,7 @@ async def rfc3339( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -743,7 +743,7 @@ async def rfc7231( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -902,7 +902,7 @@ async def unix_timestamp( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1073,7 +1073,7 @@ async def unix_timestamp_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1155,7 +1155,7 @@ async def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1203,7 +1203,7 @@ async def rfc3339( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1251,7 +1251,7 @@ async def rfc7231( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1299,7 +1299,7 @@ async def unix_timestamp( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1347,7 +1347,7 @@ async def unix_timestamp_array( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1409,7 +1409,7 @@ async def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1455,7 +1455,7 @@ async def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1501,7 +1501,7 @@ async def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1547,7 +1547,7 @@ async def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py index 0f97fa0aa8c..0f8156f356d 100644 --- a/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-datetime/encode/datetime/operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -111,9 +111,9 @@ def build_property_default_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/default" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -128,9 +128,9 @@ def build_property_rfc3339_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/rfc3339" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -145,9 +145,9 @@ def build_property_rfc7231_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/rfc7231" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -162,9 +162,9 @@ def build_property_unix_timestamp_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/unix-timestamp" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -179,9 +179,9 @@ def build_property_unix_timestamp_array_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/unix-timestamp-array" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -305,7 +305,7 @@ def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +353,7 @@ def rfc3339( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -401,7 +401,7 @@ def rfc7231( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +449,7 @@ def unix_timestamp( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +497,7 @@ def unix_timestamp_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -653,7 +653,7 @@ def default( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,7 +807,7 @@ def rfc3339( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,7 +961,7 @@ def rfc7231( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1120,7 +1120,7 @@ def unix_timestamp( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1291,7 +1291,7 @@ def unix_timestamp_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1373,7 +1373,7 @@ def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1421,7 +1421,7 @@ def rfc3339( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1469,7 +1469,7 @@ def rfc7231( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1517,7 +1517,7 @@ def unix_timestamp( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1565,7 +1565,7 @@ def unix_timestamp_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1627,7 +1627,7 @@ def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1673,7 +1673,7 @@ def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1719,7 +1719,7 @@ def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1765,7 +1765,7 @@ def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/encode-duration/README.md b/packages/typespec-python/test/azure/generated/encode-duration/README.md index 6095aeec953..cf6a016066c 100644 --- a/packages/typespec-python/test/azure/generated/encode-duration/README.md +++ b/packages/typespec-python/test/azure/generated/encode-duration/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install encode-duration diff --git a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/aio/operations/_operations.py index 373af87acb1..cf3ca630582 100644 --- a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/aio/operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -83,7 +83,7 @@ async def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +131,7 @@ async def iso8601( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,7 +179,7 @@ async def int32_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +227,7 @@ async def float_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +275,7 @@ async def int32_seconds_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +431,7 @@ async def default( "value": "1 day, 0:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -585,7 +585,7 @@ async def iso8601( "value": "1 day, 0:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -744,7 +744,7 @@ async def int32_seconds( "value": 0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -903,7 +903,7 @@ async def float_seconds( "value": 0.0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1074,7 +1074,7 @@ async def float_seconds_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1156,7 +1156,7 @@ async def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1204,7 +1204,7 @@ async def iso8601( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1252,7 +1252,7 @@ async def iso8601_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1300,7 +1300,7 @@ async def int32_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1348,7 +1348,7 @@ async def float_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/operations/_operations.py b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/operations/_operations.py index 829c6356edb..9f7e11e0584 100644 --- a/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/encode-duration/encode/duration/operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -111,9 +111,9 @@ def build_property_default_request(**kwargs: Any) -> HttpRequest: _url = "/encode/duration/property/default" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -128,9 +128,9 @@ def build_property_iso8601_request(**kwargs: Any) -> HttpRequest: _url = "/encode/duration/property/iso8601" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -145,9 +145,9 @@ def build_property_int32_seconds_request(**kwargs: Any) -> HttpRequest: _url = "/encode/duration/property/int32-seconds" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -162,9 +162,9 @@ def build_property_float_seconds_request(**kwargs: Any) -> HttpRequest: _url = "/encode/duration/property/float-seconds" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -179,9 +179,9 @@ def build_property_float_seconds_array_request(**kwargs: Any) -> HttpRequest: # _url = "/encode/duration/property/float-seconds-array" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -275,7 +275,7 @@ def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -323,7 +323,7 @@ def iso8601( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +369,7 @@ def int32_seconds(self, *, input: int, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +415,7 @@ def float_seconds(self, *, input: float, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -463,7 +463,7 @@ def int32_seconds_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -619,7 +619,7 @@ def default( "value": "1 day, 0:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,7 +773,7 @@ def iso8601( "value": "1 day, 0:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -932,7 +932,7 @@ def int32_seconds( "value": 0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1091,7 +1091,7 @@ def float_seconds( "value": 0.0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1262,7 +1262,7 @@ def float_seconds_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1344,7 +1344,7 @@ def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1392,7 +1392,7 @@ def iso8601( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1440,7 +1440,7 @@ def iso8601_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1486,7 +1486,7 @@ def int32_seconds(self, *, duration: int, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1534,7 +1534,7 @@ def float_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/headasbooleanfalse/README.md b/packages/typespec-python/test/azure/generated/headasbooleanfalse/README.md index 31dcb999b66..8dd1d057d45 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleanfalse/README.md +++ b/packages/typespec-python/test/azure/generated/headasbooleanfalse/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install headasbooleanfalse diff --git a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py index d3a7ced8d57..ec510ed081e 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -51,9 +51,9 @@ def build_visibility_get_model_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/visibility" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="GET", url=_url, headers=_headers, **kwargs) @@ -291,7 +291,7 @@ def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +439,7 @@ def head_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -580,7 +580,7 @@ def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -721,7 +721,7 @@ def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -862,7 +862,7 @@ def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1003,7 +1003,7 @@ def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py index e2e998646b1..8ba38b4d692 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -208,7 +208,7 @@ async def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -356,7 +356,7 @@ async def head_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +497,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -638,7 +638,7 @@ async def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -779,7 +779,7 @@ async def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -920,7 +920,7 @@ async def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/headasbooleantrue/README.md b/packages/typespec-python/test/azure/generated/headasbooleantrue/README.md index 0efc060bc7a..aa1d5599373 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleantrue/README.md +++ b/packages/typespec-python/test/azure/generated/headasbooleantrue/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install headasbooleantrue diff --git a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py index 381c11494fd..32652d75b47 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -51,9 +51,9 @@ def build_visibility_get_model_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/visibility" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="GET", url=_url, headers=_headers, **kwargs) @@ -291,7 +291,7 @@ def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +433,7 @@ def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes]], **k ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,7 +575,7 @@ def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +716,7 @@ def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +857,7 @@ def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -998,7 +998,7 @@ def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py index de7dfe6a53d..3b978908419 100644 --- a/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -208,7 +208,7 @@ async def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +350,7 @@ async def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes] ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +492,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +633,7 @@ async def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +774,7 @@ async def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -915,7 +915,7 @@ async def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/README.md b/packages/typespec-python/test/azure/generated/parameters-body-optionality/README.md index 67513563a75..c46b31a56b4 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/README.md +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install parameters-bodyoptionality diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py index 9024e50c346..f7dac8dc3ee 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -136,7 +136,7 @@ async def set( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +260,7 @@ async def omit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +386,7 @@ async def required_explicit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -507,7 +507,7 @@ async def required_implicit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py index 28c689833dd..23e0c7c3618 100644 --- a/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -190,7 +190,7 @@ def set( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +314,7 @@ def omit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -440,7 +440,7 @@ def required_explicit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -561,7 +561,7 @@ def required_implicit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/README.md b/packages/typespec-python/test/azure/generated/parameters-collection-format/README.md index bccfdc61152..d094692432e 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/README.md +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install parameters-collectionformat diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py index c151d3e6943..eb3e7b28719 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_query_tsv_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +67,7 @@ async def multi( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +113,7 @@ async def ssv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -154,7 +159,7 @@ async def tsv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +207,7 @@ async def pipes( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,7 +253,7 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -312,7 +317,7 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py index 85e34e7d17f..f34a04c0e42 100644 --- a/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -129,7 +134,7 @@ def multi(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +180,7 @@ def ssv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +226,7 @@ def tsv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +272,7 @@ def pipes(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +318,7 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +382,7 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/parameters-spread/README.md b/packages/typespec-python/test/azure/generated/parameters-spread/README.md index f54cfa83706..fee9766d4ec 100644 --- a/packages/typespec-python/test/azure/generated/parameters-spread/README.md +++ b/packages/typespec-python/test/azure/generated/parameters-spread/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install parameters-spread diff --git a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/aio/operations/_operations.py index f082c67ebed..3dfe39ff677 100644 --- a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -136,7 +136,7 @@ async def spread_as_request_body( # pylint: disable=inconsistent-return-stateme "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +277,7 @@ async def spread_as_request_body( # pylint: disable=inconsistent-return-stateme "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +427,7 @@ async def spread_as_request_parameter( # pylint: disable=inconsistent-return-st "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -625,7 +625,7 @@ async def spread_with_multiple_parameters( # pylint: disable=inconsistent-retur "prop6": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/operations/_operations.py b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/operations/_operations.py index 2c01ad1f688..72ff3e9fd3d 100644 --- a/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/parameters-spread/parameters/spread/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -206,7 +206,7 @@ def spread_as_request_body( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +347,7 @@ def spread_as_request_body( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +497,7 @@ def spread_as_request_parameter( # pylint: disable=inconsistent-return-statemen "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -695,7 +695,7 @@ def spread_with_multiple_parameters( # pylint: disable=inconsistent-return-stat "prop6": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-content-negotiation/README.md b/packages/typespec-python/test/azure/generated/payload-content-negotiation/README.md index a93ff0167c8..861d021514d 100644 --- a/packages/typespec-python/test/azure/generated/payload-content-negotiation/README.md +++ b/packages/typespec-python/test/azure/generated/payload-content-negotiation/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install payload-contentnegotiation diff --git a/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/aio/operations/_operations.py index 596b16f5fec..a327654f4f9 100644 --- a/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_same_body_get_avatar_as_png_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def get_avatar_as_png(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +113,7 @@ async def get_avatar_as_jpeg(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +180,7 @@ async def get_avatar_as_png(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -232,7 +237,7 @@ async def get_avatar_as_json(self, **kwargs: Any) -> _models.PngImageAsJson: "content": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/operations/_operations.py index bb911bf9eb8..97a89ad7cfc 100644 --- a/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-content-negotiation/payload/contentnegotiation/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterator, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterator, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._model_base import _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +114,7 @@ def get_avatar_as_png(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ def get_avatar_as_jpeg(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -225,7 +230,7 @@ def get_avatar_as_png(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -282,7 +287,7 @@ def get_avatar_as_json(self, **kwargs: Any) -> _models.PngImageAsJson: "content": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/README.md b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/README.md index f55eecfe2a6..8b6658000df 100644 --- a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/README.md +++ b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install payload-jsonmergepatch diff --git a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py index 69b30d41921..497a6be58bd 100644 --- a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -51,9 +51,9 @@ def build_json_merge_patch_create_resource_request(**kwargs: Any) -> HttpRequest _url = "/json-merge-patch/create/resource" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, headers=_headers, **kwargs) @@ -325,7 +325,7 @@ def create_resource(self, body: Union[_models.Resource, JSON, IO[bytes]], **kwar } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +607,7 @@ def update_resource(self, body: Union[_models.ResourcePatch, JSON, IO[bytes]], * } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -896,7 +896,7 @@ def update_optional_resource( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py index 3a5ad53661a..3fd5ce98882 100644 --- a/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -275,7 +275,7 @@ async def create_resource(self, body: Union[_models.Resource, JSON, IO[bytes]], } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -559,7 +559,7 @@ async def update_resource( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -848,7 +848,7 @@ async def update_optional_resource( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/README.md b/packages/typespec-python/test/azure/generated/payload-media-type/README.md index 33e1fc9d52d..a45881ae204 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/README.md +++ b/packages/typespec-python/test/azure/generated/payload-media-type/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install payload-mediatype diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py index 6169b9f3b73..755ff4644ac 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_string_body_send_as_text_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +66,7 @@ async def send_as_text(self, text: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +114,7 @@ async def get_as_text(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ async def send_as_json(self, text: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ async def get_as_json(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py index 38744639eb1..bd30008cc58 100644 --- a/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-media-type/payload/mediatype/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -113,7 +118,7 @@ def send_as_text(self, text: str, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ def get_as_text(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +218,7 @@ def send_as_json(self, text: str, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -261,7 +266,7 @@ def get_as_json(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-multipart/README.md b/packages/typespec-python/test/azure/generated/payload-multipart/README.md index f1e29f1bdb3..1988da6d7e5 100644 --- a/packages/typespec-python/test/azure/generated/payload-multipart/README.md +++ b/packages/typespec-python/test/azure/generated/payload-multipart/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install payload-multipart diff --git a/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/aio/operations/_operations.py index 9a83a23739d..d122be68422 100644 --- a/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/aio/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -113,7 +113,7 @@ async def basic( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +227,7 @@ async def complex( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,7 +327,7 @@ async def json_part( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -425,7 +425,7 @@ async def binary_array_parts( # pylint: disable=inconsistent-return-statements "pictures": [filetype] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -531,7 +531,7 @@ async def json_array_parts( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +629,7 @@ async def multi_binary_parts( # pylint: disable=inconsistent-return-statements "picture": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -727,7 +727,7 @@ async def check_file_name_and_content_type( # pylint: disable=inconsistent-retu "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/operations/_operations.py index ac8c3fe126f..c76636a6014 100644 --- a/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-multipart/payload/multipart/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -174,7 +174,7 @@ def basic( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,7 +288,7 @@ def complex( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -388,7 +388,7 @@ def json_part( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +484,7 @@ def binary_array_parts( # pylint: disable=inconsistent-return-statements "pictures": [filetype] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -588,7 +588,7 @@ def json_array_parts( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,7 +684,7 @@ def multi_binary_parts( # pylint: disable=inconsistent-return-statements "picture": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,7 +782,7 @@ def check_file_name_and_content_type( # pylint: disable=inconsistent-return-sta "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/README.md b/packages/typespec-python/test/azure/generated/payload-pageable/README.md index 795bcf4d583..6b6afe92184 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/README.md +++ b/packages/typespec-python/test/azure/generated/payload-pageable/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install payload-pageable diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py index d6591098bd9..12bafdd8b53 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import PageableClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.User"]: maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py index 1172dee275d..d6298ee75a8 100644 --- a/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -26,6 +27,10 @@ from ..._operations._operations import build_pageable_list_request from .._vendor import PageableClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.User"]: maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/MANIFEST.in b/packages/typespec-python/test/azure/generated/projection-projected-name/MANIFEST.in deleted file mode 100644 index f92d86cb718..00000000000 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include *.md -include LICENSE -include projection/projectedname/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include projection/__init__.py \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/operations/_operations.py deleted file mode 100644 index 0ae1cbd0cf6..00000000000 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/operations/_operations.py +++ /dev/null @@ -1,905 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ..._model_base import SdkJSONEncoder -from ...operations._operations import ( - build_model_client_request, - build_model_language_request, - build_projected_name_client_name_request, - build_projected_name_parameter_request, - build_property_client_request, - build_property_json_and_client_request, - build_property_json_request, - build_property_language_request, -) -from .._vendor import ProjectedNameClientMixinABC - -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 -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~projection.projectedname.aio.ProjectedNameClient`'s - :attr:`property` attribute. - """ - - 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") - - @overload - async def json( # pylint: disable=inconsistent-return-statements - self, body: _models.JsonProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: ~projection.projectedname.models.JsonProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - - @overload - async def json( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def json( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def json( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.JsonProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """json. - - :param body: Is one of the following types: JsonProjectedNameModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.JsonProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_json_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: _models.ClientProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~projection.projectedname.models.ClientProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is one of the following types: ClientProjectedNameModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.ClientProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: _models.LanguageProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~projection.projectedname.models.LanguageProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.LanguageProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is one of the following types: LanguageProjectedNameModel, JSON, IO[bytes] - Required. - :type body: ~projection.projectedname.models.LanguageProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: _models.JsonAndClientProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: ~projection.projectedname.models.JsonAndClientProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - - @overload - async def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.JsonAndClientProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Is one of the following types: JsonAndClientProjectedNameModel, JSON, IO[bytes] - Required. - :type body: ~projection.projectedname.models.JsonAndClientProjectedNameModel or JSON or - IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_json_and_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ModelOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~projection.projectedname.aio.ProjectedNameClient`'s - :attr:`model` attribute. - """ - - 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") - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: _models.ClientModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~projection.projectedname.models.ClientModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is one of the following types: ClientModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.ClientModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: _models.PythonModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~projection.projectedname.models.PythonModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.PythonModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is one of the following types: PythonModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.PythonModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ProjectedNameClientOperationsMixin(ProjectedNameClientMixinABC): - @distributed_trace_async - async def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """client_name. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_projected_name_client_name_request( - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def parameter( # pylint: disable=inconsistent-return-statements - self, *, client_name: str, **kwargs: Any - ) -> None: - """parameter. - - :keyword client_name: Required. - :paramtype client_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_projected_name_parameter_request( - client_name=client_name, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/models/__init__.py b/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/models/__init__.py deleted file mode 100644 index 30111291fd7..00000000000 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/models/__init__.py +++ /dev/null @@ -1,28 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models import ClientModel -from ._models import ClientProjectedNameModel -from ._models import JsonAndClientProjectedNameModel -from ._models import JsonProjectedNameModel -from ._models import LanguageProjectedNameModel -from ._models import PythonModel -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ClientModel", - "ClientProjectedNameModel", - "JsonAndClientProjectedNameModel", - "JsonProjectedNameModel", - "LanguageProjectedNameModel", - "PythonModel", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/models/_models.py b/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/models/_models.py deleted file mode 100644 index 22d361677d8..00000000000 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/models/_models.py +++ /dev/null @@ -1,199 +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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Mapping, overload - -from .. import _model_base -from .._model_base import rest_field - - -class ClientModel(_model_base.Model): - """ClientModel. - - All required parameters must be populated in order to send to server. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - default_name: bool = rest_field(name="defaultName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - default_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class ClientProjectedNameModel(_model_base.Model): - """ClientProjectedNameModel. - - All required parameters must be populated in order to send to server. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - client_name: bool = rest_field(name="defaultName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - client_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class JsonAndClientProjectedNameModel(_model_base.Model): - """JsonAndClientProjectedNameModel. - - All required parameters must be populated in order to send to server. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - client_name: bool = rest_field(name="wireName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - client_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class JsonProjectedNameModel(_model_base.Model): - """JsonProjectedNameModel. - - All required parameters must be populated in order to send to server. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - default_name: bool = rest_field(name="wireName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - default_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class LanguageProjectedNameModel(_model_base.Model): - """LanguageProjectedNameModel. - - All required parameters must be populated in order to send to server. - - :ivar python_name: Pass in true. Required. - :vartype python_name: bool - """ - - python_name: bool = rest_field(name="defaultName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - python_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class PythonModel(_model_base.Model): - """PythonModel. - - All required parameters must be populated in order to send to server. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - default_name: bool = rest_field(name="defaultName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - default_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/operations/_operations.py b/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/operations/_operations.py deleted file mode 100644 index 21da770ef59..00000000000 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/operations/_operations.py +++ /dev/null @@ -1,1000 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict - -from .. import models as _models -from .._model_base import SdkJSONEncoder -from .._serialization import Serializer -from .._vendor import ProjectedNameClientMixinABC - -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 -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_property_json_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/property/json" - - # 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_property_client_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/property/client" - - # 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_property_language_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/property/language" - - # 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_property_json_and_client_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/property/json-and-client" - - # 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_model_client_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/model/client" - - # 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_model_language_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/model/language" - - # 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_projected_name_client_name_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/projection/projected-name/operation" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_projected_name_parameter_request(*, client_name: str, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/projection/projected-name/parameter" - - # Construct parameters - _params["default-name"] = _SERIALIZER.query("client_name", client_name, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~projection.projectedname.ProjectedNameClient`'s - :attr:`property` attribute. - """ - - 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") - - @overload - def json( # pylint: disable=inconsistent-return-statements - self, body: _models.JsonProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: ~projection.projectedname.models.JsonProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - - @overload - def json( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def json( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def json( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.JsonProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """json. - - :param body: Is one of the following types: JsonProjectedNameModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.JsonProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_json_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: _models.ClientProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~projection.projectedname.models.ClientProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is one of the following types: ClientProjectedNameModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.ClientProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: _models.LanguageProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~projection.projectedname.models.LanguageProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.LanguageProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is one of the following types: LanguageProjectedNameModel, JSON, IO[bytes] - Required. - :type body: ~projection.projectedname.models.LanguageProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: _models.JsonAndClientProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: ~projection.projectedname.models.JsonAndClientProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - - @overload - def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.JsonAndClientProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Is one of the following types: JsonAndClientProjectedNameModel, JSON, IO[bytes] - Required. - :type body: ~projection.projectedname.models.JsonAndClientProjectedNameModel or JSON or - IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_json_and_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ModelOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~projection.projectedname.ProjectedNameClient`'s - :attr:`model` attribute. - """ - - 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") - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: _models.ClientModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~projection.projectedname.models.ClientModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is one of the following types: ClientModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.ClientModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: _models.PythonModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~projection.projectedname.models.PythonModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.PythonModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is one of the following types: PythonModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.PythonModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ProjectedNameClientOperationsMixin(ProjectedNameClientMixinABC): - @distributed_trace - def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """client_name. - - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_projected_name_client_name_request( - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def parameter(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """parameter. - - :keyword client_name: Required. - :paramtype client_name: str - :return: None - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_projected_name_parameter_request( - client_name=client_name, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/README.md b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/README.md index 9274bd31317..a2c41ff113f 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/README.md +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install resiliency-srv-driven1 diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_client.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_client.py index 684768d638c..1cb946ee8f4 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_client.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_client.py @@ -88,14 +88,9 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py index d11ece104c3..45f28f033f1 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import ResiliencyServiceDrivenClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +84,7 @@ def from_none(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,14 +104,9 @@ def from_none(self, **kwargs: Any) -> bool: path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -140,7 +140,7 @@ def from_one_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,14 +161,9 @@ def from_one_required( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -201,7 +196,7 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,14 +217,9 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py index 8af2bec189f..56b31a1b4bc 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py @@ -90,14 +90,9 @@ def send_request( path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py index abe388fb998..76a33de52ff 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ ) from .._vendor import ResiliencyServiceDrivenClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ async def from_none(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -63,14 +68,9 @@ async def from_none(self, **kwargs: Any) -> bool: path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -104,7 +104,7 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,14 +125,9 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -165,7 +160,7 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,14 +181,9 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/README.md b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/README.md index 5fd6ba7f0ea..a6703b3c658 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/README.md +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install resiliency-srv-driven2 diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_client.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_client.py index 814d13efbe7..9d1ab3097fd 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_client.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_client.py @@ -107,14 +107,9 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py index 9ac3f982e4a..927f7c1db98 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._validation import api_version_validation from .._vendor import ResiliencyServiceDrivenClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -103,7 +108,7 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,14 +128,9 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -163,7 +163,7 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,14 +184,9 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -230,7 +225,7 @@ def from_one_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -252,14 +247,9 @@ def from_one_required( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -297,7 +287,7 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,14 +309,9 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py index d701e33f052..496aff88555 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py @@ -109,14 +109,9 @@ def send_request( path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py index 68424d93c88..3178eb67c7a 100644 --- a/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._validation import api_version_validation from .._vendor import ResiliencyServiceDrivenClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,7 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -67,14 +72,9 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -107,7 +107,7 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,14 +128,9 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -174,7 +169,7 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -196,14 +191,9 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -241,7 +231,7 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,14 +253,9 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/README.md b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/README.md index 01068685942..dcb438fa117 100644 --- a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/README.md +++ b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install serialization-encodedname-json diff --git a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py index eb56c3f1e6e..81c4b5b8530 100644 --- a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -130,7 +130,7 @@ async def send( # pylint: disable=inconsistent-return-statements "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +191,7 @@ async def get(self, **kwargs: Any) -> _models.JsonEncodedNameModel: "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py index 10d35d188d6..ac504c1a142 100644 --- a/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -161,7 +161,7 @@ def send( # pylint: disable=inconsistent-return-statements "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +222,7 @@ def get(self, **kwargs: Any) -> _models.JsonEncodedNameModel: "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/CHANGELOG.md b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/CHANGELOG.md similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/CHANGELOG.md rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/CHANGELOG.md diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/LICENSE b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/LICENSE new file mode 100644 index 00000000000..63447fd8bbb --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/MANIFEST.in b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/MANIFEST.in new file mode 100644 index 00000000000..3fb7e5ef0a6 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/MANIFEST.in @@ -0,0 +1,7 @@ +include *.md +include LICENSE +include server/endpoint/notdefined/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include server/__init__.py +include server/endpoint/__init__.py \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/README.md b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/README.md new file mode 100644 index 00000000000..a053ffb3406 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/README.md @@ -0,0 +1,45 @@ + + +# Server Endpoint Notdefined client library for Python + + +## Getting started + +### Install the package + +```bash +python -m pip install server-endpoint-notdefined +``` + +#### Prequisites + +- Python 3.8 or later is required to use this package. +- You need an [Azure subscription][azure_sub] to use this package. +- An existing Server Endpoint Notdefined instance. + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, +see the Code of Conduct FAQ or contact opencode@microsoft.com with any +additional questions or comments. + + +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ +[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials +[azure_identity_pip]: https://pypi.org/project/azure-identity/ +[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential +[pip]: https://pypi.org/project/pip/ +[azure_sub]: https://azure.microsoft.com/free/ + diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/dev_requirements.txt b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/dev_requirements.txt new file mode 100644 index 00000000000..ff12ab35dd0 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/dev_requirements.txt @@ -0,0 +1,4 @@ +-e ../../../tools/azure-devtools +-e ../../../tools/azure-sdk-tools +../../core/azure-core +aiohttp \ No newline at end of file diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/__init__.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/__init__.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/__init__.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/__init__.py new file mode 100644 index 00000000000..6bbf4cfce76 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/__init__.py @@ -0,0 +1,26 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._client import NotDefinedClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "NotDefinedClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_client.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_client.py new file mode 100644 index 00000000000..ab4465c13a9 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_client.py @@ -0,0 +1,91 @@ +# 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) Python 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.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse + +from ._configuration import NotDefinedClientConfiguration +from ._operations import NotDefinedClientOperationsMixin +from ._serialization import Deserializer, Serializer + + +class NotDefinedClient(NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let + user pass in. + + :param endpoint: Service host. Required. + :type endpoint: str + """ + + def __init__( # pylint: disable=missing-client-constructor-parameter-credential + self, endpoint: str, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + self._config = NotDefinedClientConfiguration(endpoint=endpoint, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request(self, request: HttpRequest, *, stream: bool = False, **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) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> "NotDefinedClient": + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_configuration.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_configuration.py new file mode 100644 index 00000000000..d5d4d330b2d --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_configuration.py @@ -0,0 +1,44 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any + +from azure.core.pipeline import policies + +from ._version import VERSION + + +class NotDefinedClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for NotDefinedClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Service host. Required. + :type endpoint: str + """ + + def __init__(self, endpoint: str, **kwargs: Any) -> None: + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + + self.endpoint = endpoint + kwargs.setdefault("sdk_moniker", "server-endpoint-notdefined/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_model_base.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_model_base.py new file mode 100644 index 00000000000..1ddc071517d --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_model_base.py @@ -0,0 +1,874 @@ +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except + +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import copy +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] # pylint: disable=protected-access + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_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}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _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") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object + def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + self._data = copy.deepcopy(data) + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: + ... + + @typing.overload + def pop(self, key: str, default: _T) -> _T: + ... + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: + ... + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> typing.Tuple[str, typing.Any]: + return self._data.popitem() + + def clear(self) -> None: + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: + ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: + ... + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field( + attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: disable=unused-argument + # we know the last three classes in mro are going to be 'Model', 'dict', and 'object' + mros = cls.__mro__[:-3][::-1] # ignore model, dict, and object parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") # pylint: disable=no-member + for k, v in mro_class.__annotations__.items() # pylint: disable=no-member + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + + return super().__new__(cls) # pylint: disable=no-value-for-parameter + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): # pylint: disable=no-member + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional[str]: + for v in cls.__dict__.values(): + if ( + isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators + ): # pylint: disable=protected-access + return v._rest_name # pylint: disable=protected-access + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): # pylint: disable=no-member + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + exist_discriminators.append(discriminator) + mapped_cls = cls.__mapping__.get(data.get(discriminator), cls) # pyright: ignore # pylint: disable=no-member + if mapped_cls == cls: + return cls(data) + return mapped_cls._deserialize(data, exist_discriminators) # pylint: disable=protected-access + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + """Return a dict that can be JSONify using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _get_deserialize_callable_from_annotation( # pylint: disable=R0911, R0915, R0912 + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation or annotation in [int, float]: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + except AttributeError: + pass + + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in sorted( + annotation.__args__, key=lambda x: hasattr(x, "__name__") and x.__name__ == "str" # pyright: ignore + ) + ] + + def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + return functools.partial(_deserialize_with_union, deserializers) + + try: + if annotation._name == "Dict": # pyright: ignore + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + obj: typing.Dict[typing.Any, typing.Any], + ): + if obj is None: + return obj + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + return functools.partial( + _deserialize_dict, + value_deserializer, + ) + except (AttributeError, IndexError): + pass + try: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore + + def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + obj, + ): + if obj is None: + return obj + return type(obj)( + _deserialize(deserializer, entry, module) + for entry, deserializer in zip(obj, entry_deserializers) + ) + + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + obj, + ): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + return functools.partial(_deserialize_sequence, deserializer) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): + try: + if value is None or isinstance(value, _Null): + return None + if deserializer is None: + return value + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True) diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/__init__.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/__init__.py new file mode 100644 index 00000000000..f2d0944ac08 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import NotDefinedClientOperationsMixin + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "NotDefinedClientOperationsMixin", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py new file mode 100644 index 00000000000..5f541fa3c35 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py @@ -0,0 +1,91 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from .._serialization import Serializer +from .._vendor import NotDefinedClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_not_defined_valid_request(**kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/server/endpoint/not-defined/valid" + + return HttpRequest(method="HEAD", url=_url, **kwargs) + + +class NotDefinedClientOperationsMixin(NotDefinedClientMixinABC): + @distributed_trace + def valid(self, **kwargs: Any) -> bool: + """valid. + + :return: bool + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_not_defined_valid_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + return 200 <= response.status_code <= 299 diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/models/_patch.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py similarity index 100% rename from packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/models/_patch.py rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/_patch.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py similarity index 94% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/_patch.py rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py index cc9d8be1c50..f7dd3251033 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/_patch.py +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py @@ -1,5 +1,5 @@ # ------------------------------------ -# Copyright (c) Unbranded Corporation. +# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ """Customize generated code here. diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_serialization.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_serialization.py new file mode 100644 index 00000000000..2f781d74082 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_serialization.py @@ -0,0 +1,1998 @@ +# -------------------------------------------------------------------------- +# +# 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 +# pyright: reportUnnecessaryTypeIgnoreComment=false + +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 +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + + +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: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> 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) # nosec + except ET.ParseError as err: + # 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 DeserializationError("XML is invalid") from err + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: 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 + + +_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 # type: ignore +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 +except ImportError: + TZ_UTC = UTC() # type: ignore + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[Dict[str, Any]] = {} + for k in kwargs: + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes.""" + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node.""" + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises: DeserializationError if something went wrong + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result.update(objects[valuetype]._flatten_subtype(key, objects)) + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + Remove the polymorphic key from the initial data. + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + """ + return key.replace("\\.", ".") + + +class Serializer(object): + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > 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: Optional[Mapping[str, type]] = 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[str, type] = 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) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + 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) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from 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_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, 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 = [ # type: ignore + 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 SerializationError("Unable to build a model: " + str(err)) from 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) + output = output.replace("{", quote("{")).replace("}", quote("}")) + 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. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list + :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] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **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 is CoreNull: + return None + 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 SerializationError(msg.format(data, data_type)) from 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) # nosec + + @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): # type: ignore + # 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'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. + :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 as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + 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 as err: + if isinstance(err, SerializationError): + raise + 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 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) # type: ignore + return result + except ValueError: + for enum_value in enum_obj: # type: ignore + 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 SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from 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: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _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 + 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 + 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: Optional[Mapping[str, type]] = 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[str, type] = 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, str): + 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 # type: ignore + 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 # type: ignore + raise DeserializationError(msg) from 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 deserialize. + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + 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 deserialize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.debug( + "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, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + 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) # type: ignore + 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 DeserializationError(msg) from 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, str): + 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, str): + 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) # nosec + + @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): # type: ignore + 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. + 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)) # type: ignore + + @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) # type: ignore + attr = attr + padding # type: ignore + 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(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from 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) # type: ignore + + @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 DeserializationError(msg) from 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): # type: ignore + 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=0, defaultday=0) + + @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): # type: ignore + 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) # type: ignore + 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 DeserializationError(msg) from 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() # type: ignore + 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 DeserializationError(msg) from 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) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + else: + return date_obj diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_vendor.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_vendor.py similarity index 85% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_vendor.py rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_vendor.py index e15d771b693..255a7102b86 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/_vendor.py +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_vendor.py @@ -8,7 +8,7 @@ from abc import ABC from typing import TYPE_CHECKING -from ._configuration import ProjectedNameClientConfiguration +from ._configuration import NotDefinedClientConfiguration if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -17,10 +17,10 @@ from ._serialization import Deserializer, Serializer -class ProjectedNameClientMixinABC(ABC): +class NotDefinedClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "PipelineClient" - _config: ProjectedNameClientConfiguration + _config: NotDefinedClientConfiguration _serialize: "Serializer" _deserialize: "Deserializer" diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/models/_enums.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_version.py similarity index 65% rename from packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/models/_enums.py rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_version.py index 72047e93d8e..be71c81bd28 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/models/_enums.py +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/_version.py @@ -6,12 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ImmediateSuccessResponse(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of ImmediateSuccessResponse.""" - - ACCEPTED = "accepted" - REJECTED = "rejected" +VERSION = "1.0.0b1" diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/__init__.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/__init__.py new file mode 100644 index 00000000000..c7e716988e3 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/__init__.py @@ -0,0 +1,23 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._client import NotDefinedClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "NotDefinedClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py new file mode 100644 index 00000000000..0044c6327b8 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py @@ -0,0 +1,93 @@ +# 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) Python 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.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest + +from .._serialization import Deserializer, Serializer +from ._configuration import NotDefinedClientConfiguration +from ._operations import NotDefinedClientOperationsMixin + + +class NotDefinedClient(NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let + user pass in. + + :param endpoint: Service host. Required. + :type endpoint: str + """ + + def __init__( # pylint: disable=missing-client-constructor-parameter-credential + self, endpoint: str, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + self._config = NotDefinedClientConfiguration(endpoint=endpoint, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **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) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "NotDefinedClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_configuration.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_configuration.py new file mode 100644 index 00000000000..04721ce9e6c --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_configuration.py @@ -0,0 +1,44 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any + +from azure.core.pipeline import policies + +from .._version import VERSION + + +class NotDefinedClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for NotDefinedClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Service host. Required. + :type endpoint: str + """ + + def __init__(self, endpoint: str, **kwargs: Any) -> None: + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + + self.endpoint = endpoint + kwargs.setdefault("sdk_moniker", "server-endpoint-notdefined/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/__init__.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/__init__.py new file mode 100644 index 00000000000..f2d0944ac08 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import NotDefinedClientOperationsMixin + +from ._patch import __all__ as _patch_all +from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "NotDefinedClientOperationsMixin", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py new file mode 100644 index 00000000000..4fa13262a4c --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py @@ -0,0 +1,81 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ..._operations._operations import build_not_defined_valid_request +from .._vendor import NotDefinedClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NotDefinedClientOperationsMixin(NotDefinedClientMixinABC): + @distributed_trace_async + async def valid(self, **kwargs: Any) -> bool: + """valid. + + :return: bool + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_not_defined_valid_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + return 200 <= response.status_code <= 299 diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/_patch.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py similarity index 94% rename from packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/_patch.py rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py index cc9d8be1c50..f7dd3251033 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/_patch.py +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py @@ -1,5 +1,5 @@ # ------------------------------------ -# Copyright (c) Unbranded Corporation. +# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ """Customize generated code here. diff --git a/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py new file mode 100644 index 00000000000..f7dd3251033 --- /dev/null +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# 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 List + +__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. + + `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/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_vendor.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_vendor.py similarity index 85% rename from packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_vendor.py rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_vendor.py index 4acbf3c435b..9d570aa5bbd 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/projection/projectedname/aio/_vendor.py +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_vendor.py @@ -8,7 +8,7 @@ from abc import ABC from typing import TYPE_CHECKING -from ._configuration import ProjectedNameClientConfiguration +from ._configuration import NotDefinedClientConfiguration if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -17,10 +17,10 @@ from .._serialization import Deserializer, Serializer -class ProjectedNameClientMixinABC(ABC): +class NotDefinedClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "AsyncPipelineClient" - _config: ProjectedNameClientConfiguration + _config: NotDefinedClientConfiguration _serialize: "Serializer" _deserialize: "Deserializer" diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/py.typed b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/py.typed similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/py.typed rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/server/endpoint/notdefined/py.typed diff --git a/packages/typespec-python/test/azure/generated/projection-projected-name/setup.py b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/setup.py similarity index 91% rename from packages/typespec-python/test/azure/generated/projection-projected-name/setup.py rename to packages/typespec-python/test/azure/generated/server-endpoint-not-defined/setup.py index e655a3e612c..e4626a83540 100644 --- a/packages/typespec-python/test/azure/generated/projection-projected-name/setup.py +++ b/packages/typespec-python/test/azure/generated/server-endpoint-not-defined/setup.py @@ -12,8 +12,8 @@ from setuptools import setup, find_packages -PACKAGE_NAME = "projection-projectedname" -PACKAGE_PPRINT_NAME = "Projection Projectedname" +PACKAGE_NAME = "server-endpoint-notdefined" +PACKAGE_PPRINT_NAME = "Server Endpoint Notdefined" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace("-", "/") @@ -54,12 +54,13 @@ exclude=[ "tests", # Exclude packages that will be covered by PEP420 or nspkg - "projection", + "server", + "server.endpoint", ] ), include_package_data=True, package_data={ - "projection.projectedname": ["py.typed"], + "server.endpoint.notdefined": ["py.typed"], }, install_requires=[ "isodate>=0.6.1", diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/README.md b/packages/typespec-python/test/azure/generated/server-path-multiple/README.md index 8aab8eb764f..dc1b26979d8 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/README.md +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install server-path-multiple diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_client.py b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_client.py index 5a0277fbbbc..ed249310969 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_client.py +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_client.py @@ -25,7 +25,7 @@ class MultipleClient(MultipleClientOperationsMixin): # pylint: disable=client-a :type endpoint: str :keyword api_version: Pass in v1.0 for API version. Default value is "v1.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str + :paramtype api_version: str or ~server.path.multiple.models.Versions """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential @@ -77,9 +77,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_configuration.py b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_configuration.py index f6aa964778c..b9a4e5e45a4 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_configuration.py +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_configuration.py @@ -23,7 +23,7 @@ class MultipleClientConfiguration: # pylint: disable=too-many-instance-attribut :type endpoint: str :keyword api_version: Pass in v1.0 for API version. Default value is "v1.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str + :paramtype api_version: str or ~server.path.multiple.models.Versions """ def __init__(self, endpoint: str, **kwargs: Any) -> None: diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_operations/_operations.py index 4b9df9409c9..520097eb31a 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import MultipleClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,9 +84,7 @@ def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=inconsi ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -113,7 +116,7 @@ def with_operation_path_param( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,9 +136,7 @@ def with_operation_path_param( # pylint: disable=inconsistent-return-statements ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_client.py b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_client.py index 2d4c597191d..529fe099a8c 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_client.py @@ -25,7 +25,7 @@ class MultipleClient(MultipleClientOperationsMixin): # pylint: disable=client-a :type endpoint: str :keyword api_version: Pass in v1.0 for API version. Default value is "v1.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str + :paramtype api_version: str or ~server.path.multiple.models.Versions """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential @@ -79,9 +79,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_configuration.py b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_configuration.py index 66dc2179976..fd7ef800459 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_configuration.py +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_configuration.py @@ -23,7 +23,7 @@ class MultipleClientConfiguration: # pylint: disable=too-many-instance-attribut :type endpoint: str :keyword api_version: Pass in v1.0 for API version. Default value is "v1.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str + :paramtype api_version: str or ~server.path.multiple.models.Versions """ def __init__(self, endpoint: str, **kwargs: Any) -> None: diff --git a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py index 4b9cee6388f..902888d5b4c 100644 --- a/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ ) from .._vendor import MultipleClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +44,7 @@ async def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -58,9 +63,7 @@ async def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=i ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -92,7 +95,7 @@ async def with_operation_path_param( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,9 +115,7 @@ async def with_operation_path_param( # pylint: disable=inconsistent-return-stat ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/azure/generated/server-path-single/README.md b/packages/typespec-python/test/azure/generated/server-path-single/README.md index 5cbb7c74e60..490f5929f58 100644 --- a/packages/typespec-python/test/azure/generated/server-path-single/README.md +++ b/packages/typespec-python/test/azure/generated/server-path-single/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install server-path-single diff --git a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/_operations/_operations.py index ef1fe19dae9..bd9b0502d43 100644 --- a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import SingleClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ def my_op(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/aio/_operations/_operations.py index 881814ebca0..d23d50ba23a 100644 --- a/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-path-single/server/path/single/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_single_my_op_request from .._vendor import SingleClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +41,7 @@ async def my_op(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/README.md b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/README.md index 546a46f31a0..ea4c5ee345a 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/README.md +++ b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install server-versions-notversioned diff --git a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py index 8d38536e30b..c7cbd3d5787 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import NotVersionedClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -75,7 +80,7 @@ def without_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,7 +127,7 @@ def with_query_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,7 +175,7 @@ def with_path_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py index 753b1a3967f..1a61a1f32e8 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ ) from .._vendor import NotVersionedClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ async def without_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -87,7 +92,7 @@ async def with_query_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +140,7 @@ async def with_path_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/README.md b/packages/typespec-python/test/azure/generated/server-versions-versioned/README.md index ea0c424a5fc..ec3569014ae 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/README.md +++ b/packages/typespec-python/test/azure/generated/server-versions-versioned/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install server-versions-versioned diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py index e264aab99d8..037b7989a77 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import VersionedClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,7 @@ def without_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +125,7 @@ def with_query_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +173,7 @@ def with_path_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py index 3199ded8fd1..034289ace3d 100644 --- a/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ ) from .._vendor import VersionedClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ async def without_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -87,7 +92,7 @@ async def with_query_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -135,7 +140,7 @@ async def with_path_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/special-headers-client-request-id/README.md b/packages/typespec-python/test/azure/generated/special-headers-client-request-id/README.md index cdee36ba342..5ab961256d5 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-client-request-id/README.md +++ b/packages/typespec-python/test/azure/generated/special-headers-client-request-id/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specialheaders-clientrequestid diff --git a/packages/typespec-python/test/azure/generated/special-headers-client-request-id/specialheaders/clientrequestid/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-client-request-id/specialheaders/clientrequestid/_operations/_operations.py index ba1c86f30f6..396a2dab029 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-client-request-id/specialheaders/clientrequestid/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-client-request-id/specialheaders/clientrequestid/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._serialization import Serializer from .._vendor import ClientRequestIdClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/special-headers-client-request-id/specialheaders/clientrequestid/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-client-request-id/specialheaders/clientrequestid/aio/_operations/_operations.py index 96b838da32d..980abe66304 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-client-request-id/specialheaders/clientrequestid/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-client-request-id/specialheaders/clientrequestid/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_client_request_id_get_request from .._vendor import ClientRequestIdClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +41,7 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/README.md b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/README.md index d77f689c84c..30e1ebc66bc 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/README.md +++ b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specialheaders-conditionalrequest diff --git a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py index 341156d9421..395aa8e944e 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core import MatchConditions from azure.core.exceptions import ( @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import ConditionalRequestClientMixinABC, prep_if_match, prep_if_none_match +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +92,7 @@ def post_if_match( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -145,7 +150,7 @@ def post_if_none_match( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py index 2c040e239c6..a275e2817bd 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core import MatchConditions from azure.core.exceptions import ( @@ -28,6 +29,10 @@ ) from .._vendor import ConditionalRequestClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ async def post_if_match( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +111,7 @@ async def post_if_none_match( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/README.md b/packages/typespec-python/test/azure/generated/special-headers-repeatability/README.md index 5c266f4a658..6447c0a79a2 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/README.md +++ b/packages/typespec-python/test/azure/generated/special-headers-repeatability/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specialheaders-repeatability diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py index 288257019e6..7848385ed4b 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar import uuid from azure.core.exceptions import ( @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import RepeatabilityClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ def immediate_success(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py index fdd4b347fa7..095fda7c910 100644 --- a/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from ..._operations._operations import build_repeatability_immediate_success_request from .._vendor import RepeatabilityClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -36,7 +41,7 @@ async def immediate_success(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/special-words/README.md b/packages/typespec-python/test/azure/generated/special-words/README.md index 122b5379b0c..2c5ffef5df8 100644 --- a/packages/typespec-python/test/azure/generated/special-words/README.md +++ b/packages/typespec-python/test/azure/generated/special-words/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install specialwords diff --git a/packages/typespec-python/test/azure/generated/special-words/specialwords/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/special-words/specialwords/aio/operations/_operations.py index bc93306b561..4c171921e6f 100644 --- a/packages/typespec-python/test/azure/generated/special-words/specialwords/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-words/specialwords/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -232,7 +232,7 @@ async def with_and( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +353,7 @@ async def with_as( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -474,7 +474,7 @@ async def with_assert( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -595,7 +595,7 @@ async def with_async( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +716,7 @@ async def with_await( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -837,7 +837,7 @@ async def with_break( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -958,7 +958,7 @@ async def with_class( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1079,7 +1079,7 @@ async def with_constructor( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1200,7 +1200,7 @@ async def with_continue( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1321,7 +1321,7 @@ async def with_def( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1442,7 +1442,7 @@ async def with_del( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1563,7 +1563,7 @@ async def with_elif( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1684,7 +1684,7 @@ async def with_else( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1805,7 +1805,7 @@ async def with_except( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1926,7 +1926,7 @@ async def with_exec( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2047,7 +2047,7 @@ async def with_finally( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2168,7 +2168,7 @@ async def with_for( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2289,7 +2289,7 @@ async def with_from( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2410,7 +2410,7 @@ async def with_global( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2531,7 +2531,7 @@ async def with_if( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2652,7 +2652,7 @@ async def with_import( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2773,7 +2773,7 @@ async def with_in( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2894,7 +2894,7 @@ async def with_is( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3015,7 +3015,7 @@ async def with_lambda( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3136,7 +3136,7 @@ async def with_not( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3257,7 +3257,7 @@ async def with_or( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3378,7 +3378,7 @@ async def with_pass( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3499,7 +3499,7 @@ async def with_raise( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3620,7 +3620,7 @@ async def with_return( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3741,7 +3741,7 @@ async def with_try( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3862,7 +3862,7 @@ async def with_while( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3983,7 +3983,7 @@ async def with_with( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4104,7 +4104,7 @@ async def with_yield( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4243,7 +4243,7 @@ async def same_as_model( # pylint: disable=inconsistent-return-statements "SameAsModel": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4314,7 +4314,7 @@ async def and_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4357,7 +4357,7 @@ async def as_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4400,7 +4400,7 @@ async def assert_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4443,7 +4443,7 @@ async def async_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4486,7 +4486,7 @@ async def await_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4529,7 +4529,7 @@ async def break_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4572,7 +4572,7 @@ async def class_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4615,7 +4615,7 @@ async def constructor(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4658,7 +4658,7 @@ async def continue_method(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4701,7 +4701,7 @@ async def def_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4744,7 +4744,7 @@ async def del_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4787,7 +4787,7 @@ async def elif_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4830,7 +4830,7 @@ async def else_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4873,7 +4873,7 @@ async def except_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4916,7 +4916,7 @@ async def exec_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4959,7 +4959,7 @@ async def finally_method(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5002,7 +5002,7 @@ async def for_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5045,7 +5045,7 @@ async def from_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5088,7 +5088,7 @@ async def global_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5131,7 +5131,7 @@ async def if_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5174,7 +5174,7 @@ async def import_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5217,7 +5217,7 @@ async def in_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5260,7 +5260,7 @@ async def is_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5303,7 +5303,7 @@ async def lambda_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5346,7 +5346,7 @@ async def not_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5389,7 +5389,7 @@ async def or_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5432,7 +5432,7 @@ async def pass_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5475,7 +5475,7 @@ async def raise_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5518,7 +5518,7 @@ async def return_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5561,7 +5561,7 @@ async def try_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5604,7 +5604,7 @@ async def while_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5647,7 +5647,7 @@ async def with_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5690,7 +5690,7 @@ async def yield_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5755,7 +5755,7 @@ async def with_and( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5803,7 +5803,7 @@ async def with_as( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5851,7 +5851,7 @@ async def with_assert( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5899,7 +5899,7 @@ async def with_async( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5947,7 +5947,7 @@ async def with_await( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5995,7 +5995,7 @@ async def with_break( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6043,7 +6043,7 @@ async def with_class( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6091,7 +6091,7 @@ async def with_constructor( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6139,7 +6139,7 @@ async def with_continue( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6187,7 +6187,7 @@ async def with_def( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6235,7 +6235,7 @@ async def with_del( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6283,7 +6283,7 @@ async def with_elif( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6331,7 +6331,7 @@ async def with_else( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6379,7 +6379,7 @@ async def with_except( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6427,7 +6427,7 @@ async def with_exec( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6475,7 +6475,7 @@ async def with_finally( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6523,7 +6523,7 @@ async def with_for( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6571,7 +6571,7 @@ async def with_from( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6619,7 +6619,7 @@ async def with_global( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6667,7 +6667,7 @@ async def with_if( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6715,7 +6715,7 @@ async def with_import( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6763,7 +6763,7 @@ async def with_in( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6811,7 +6811,7 @@ async def with_is( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6859,7 +6859,7 @@ async def with_lambda( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6907,7 +6907,7 @@ async def with_not( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6955,7 +6955,7 @@ async def with_or( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7003,7 +7003,7 @@ async def with_pass( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7051,7 +7051,7 @@ async def with_raise( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7099,7 +7099,7 @@ async def with_return( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7147,7 +7147,7 @@ async def with_try( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7195,7 +7195,7 @@ async def with_while( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7243,7 +7243,7 @@ async def with_with( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7291,7 +7291,7 @@ async def with_yield( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7339,7 +7339,7 @@ async def with_cancellation_token( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/special-words/specialwords/operations/_operations.py b/packages/typespec-python/test/azure/generated/special-words/specialwords/operations/_operations.py index fe96c67e5e4..16ddcca0ece 100644 --- a/packages/typespec-python/test/azure/generated/special-words/specialwords/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/special-words/specialwords/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -1252,7 +1252,7 @@ def with_and( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1373,7 +1373,7 @@ def with_as( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1494,7 +1494,7 @@ def with_assert( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1615,7 +1615,7 @@ def with_async( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1736,7 +1736,7 @@ def with_await( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1857,7 +1857,7 @@ def with_break( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1978,7 +1978,7 @@ def with_class( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2099,7 +2099,7 @@ def with_constructor( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2220,7 +2220,7 @@ def with_continue( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2341,7 +2341,7 @@ def with_def( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2462,7 +2462,7 @@ def with_del( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2583,7 +2583,7 @@ def with_elif( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2704,7 +2704,7 @@ def with_else( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2825,7 +2825,7 @@ def with_except( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2946,7 +2946,7 @@ def with_exec( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3067,7 +3067,7 @@ def with_finally( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3188,7 +3188,7 @@ def with_for( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3309,7 +3309,7 @@ def with_from( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3430,7 +3430,7 @@ def with_global( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3551,7 +3551,7 @@ def with_if( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3672,7 +3672,7 @@ def with_import( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3793,7 +3793,7 @@ def with_in( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3914,7 +3914,7 @@ def with_is( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4035,7 +4035,7 @@ def with_lambda( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4156,7 +4156,7 @@ def with_not( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4277,7 +4277,7 @@ def with_or( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4398,7 +4398,7 @@ def with_pass( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4519,7 +4519,7 @@ def with_raise( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4640,7 +4640,7 @@ def with_return( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4761,7 +4761,7 @@ def with_try( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4882,7 +4882,7 @@ def with_while( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5003,7 +5003,7 @@ def with_with( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5124,7 +5124,7 @@ def with_yield( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5263,7 +5263,7 @@ def same_as_model( # pylint: disable=inconsistent-return-statements "SameAsModel": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5334,7 +5334,7 @@ def and_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5377,7 +5377,7 @@ def as_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5420,7 +5420,7 @@ def assert_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5463,7 +5463,7 @@ def async_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5506,7 +5506,7 @@ def await_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5549,7 +5549,7 @@ def break_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5592,7 +5592,7 @@ def class_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5635,7 +5635,7 @@ def constructor(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5678,7 +5678,7 @@ def continue_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5721,7 +5721,7 @@ def def_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5764,7 +5764,7 @@ def del_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5807,7 +5807,7 @@ def elif_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5850,7 +5850,7 @@ def else_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5893,7 +5893,7 @@ def except_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5936,7 +5936,7 @@ def exec_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5979,7 +5979,7 @@ def finally_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6022,7 +6022,7 @@ def for_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6065,7 +6065,7 @@ def from_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6108,7 +6108,7 @@ def global_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6151,7 +6151,7 @@ def if_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6194,7 +6194,7 @@ def import_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6237,7 +6237,7 @@ def in_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6280,7 +6280,7 @@ def is_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6323,7 +6323,7 @@ def lambda_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6366,7 +6366,7 @@ def not_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6409,7 +6409,7 @@ def or_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6452,7 +6452,7 @@ def pass_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6495,7 +6495,7 @@ def raise_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6538,7 +6538,7 @@ def return_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6581,7 +6581,7 @@ def try_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6624,7 +6624,7 @@ def while_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6667,7 +6667,7 @@ def with_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6710,7 +6710,7 @@ def yield_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6773,7 +6773,7 @@ def with_and(self, *, and_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6819,7 +6819,7 @@ def with_as(self, *, as_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6867,7 +6867,7 @@ def with_assert( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6915,7 +6915,7 @@ def with_async( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6963,7 +6963,7 @@ def with_await( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7011,7 +7011,7 @@ def with_break( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7059,7 +7059,7 @@ def with_class( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7107,7 +7107,7 @@ def with_constructor( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7155,7 +7155,7 @@ def with_continue( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7201,7 +7201,7 @@ def with_def(self, *, def_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7247,7 +7247,7 @@ def with_del(self, *, del_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7295,7 +7295,7 @@ def with_elif( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7343,7 +7343,7 @@ def with_else( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7391,7 +7391,7 @@ def with_except( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7439,7 +7439,7 @@ def with_exec( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7487,7 +7487,7 @@ def with_finally( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7533,7 +7533,7 @@ def with_for(self, *, for_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7581,7 +7581,7 @@ def with_from( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7629,7 +7629,7 @@ def with_global( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7675,7 +7675,7 @@ def with_if(self, *, if_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7723,7 +7723,7 @@ def with_import( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7769,7 +7769,7 @@ def with_in(self, *, in_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7815,7 +7815,7 @@ def with_is(self, *, is_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7863,7 +7863,7 @@ def with_lambda( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7909,7 +7909,7 @@ def with_not(self, *, not_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7955,7 +7955,7 @@ def with_or(self, *, or_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8003,7 +8003,7 @@ def with_pass( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8051,7 +8051,7 @@ def with_raise( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8099,7 +8099,7 @@ def with_return( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8145,7 +8145,7 @@ def with_try(self, *, try_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8193,7 +8193,7 @@ def with_while( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8241,7 +8241,7 @@ def with_with( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8289,7 +8289,7 @@ def with_yield( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8337,7 +8337,7 @@ def with_cancellation_token( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/aio/operations/_operations.py index d84e0e1cad2..53074749aec 100644 --- a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/aio/operations/_operations.py @@ -9,7 +9,8 @@ import datetime from io import IOBase import json -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -49,6 +50,10 @@ build_unknown_value_put_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +91,7 @@ async def get(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +185,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +264,7 @@ async def get(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +358,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +437,7 @@ async def get(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -526,7 +531,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -605,7 +610,7 @@ async def get(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +704,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +783,7 @@ async def get(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -872,7 +877,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -951,7 +956,7 @@ async def get(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1045,7 +1050,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1124,7 +1129,7 @@ async def get(self, **kwargs: Any) -> List[datetime.timedelta]: "1 day, 0:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1218,7 +1223,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1297,7 +1302,7 @@ async def get(self, **kwargs: Any) -> List[Any]: {} # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1391,7 +1396,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1475,7 +1480,7 @@ async def get(self, **kwargs: Any) -> List[_models.InnerModel]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1574,7 +1579,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1653,7 +1658,7 @@ async def get(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1752,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/operations/_operations.py index 9831efa69b2..2bfaae98bc7 100644 --- a/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-array/typetest/array/operations/_operations.py @@ -9,7 +9,8 @@ import datetime from io import IOBase import json -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -348,7 +353,7 @@ def get(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +447,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,7 +526,7 @@ def get(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -615,7 +620,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -694,7 +699,7 @@ def get(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -788,7 +793,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -867,7 +872,7 @@ def get(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,7 +966,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1040,7 +1045,7 @@ def get(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1134,7 +1139,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1213,7 +1218,7 @@ def get(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1307,7 +1312,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1386,7 +1391,7 @@ def get(self, **kwargs: Any) -> List[datetime.timedelta]: "1 day, 0:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1480,7 +1485,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1559,7 +1564,7 @@ def get(self, **kwargs: Any) -> List[Any]: {} # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1653,7 +1658,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1737,7 +1742,7 @@ def get(self, **kwargs: Any) -> List[_models.InnerModel]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1836,7 +1841,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1915,7 +1920,7 @@ def get(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2009,7 +2014,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-dictionary/README.md b/packages/typespec-python/test/azure/generated/typetest-dictionary/README.md index 5771ecb28af..b7876ea14b8 100644 --- a/packages/typespec-python/test/azure/generated/typetest-dictionary/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-dictionary/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-dictionary diff --git a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py index 67dd70fbec8..fad7da00d69 100644 --- a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py @@ -9,7 +9,8 @@ import datetime from io import IOBase import json -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -51,6 +52,10 @@ build_unknown_value_put_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +93,7 @@ async def get(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +187,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -261,7 +266,7 @@ async def get(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -355,7 +360,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,7 +439,7 @@ async def get(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,7 +533,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +612,7 @@ async def get(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -701,7 +706,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -780,7 +785,7 @@ async def get(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -874,7 +879,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -953,7 +958,7 @@ async def get(self, **kwargs: Any) -> Dict[str, datetime.datetime]: "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1047,7 +1052,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1126,7 +1131,7 @@ async def get(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: "str": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1220,7 +1225,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1299,7 +1304,7 @@ async def get(self, **kwargs: Any) -> Dict[str, Any]: "str": {} # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1393,7 +1398,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1477,7 +1482,7 @@ async def get(self, **kwargs: Any) -> Dict[str, _models.InnerModel]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1576,7 +1581,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1660,7 +1665,7 @@ async def get(self, **kwargs: Any) -> Dict[str, _models.InnerModel]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1759,7 +1764,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1838,7 +1843,7 @@ async def get(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1932,7 +1937,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py index f70f15ca5e6..04de7f817a1 100644 --- a/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py @@ -9,7 +9,8 @@ import datetime from io import IOBase import json -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -376,7 +381,7 @@ def get(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +475,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -549,7 +554,7 @@ def get(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -643,7 +648,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -722,7 +727,7 @@ def get(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,7 +821,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -895,7 +900,7 @@ def get(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -989,7 +994,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1068,7 +1073,7 @@ def get(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1162,7 +1167,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1241,7 +1246,7 @@ def get(self, **kwargs: Any) -> Dict[str, datetime.datetime]: "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1335,7 +1340,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1414,7 +1419,7 @@ def get(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: "str": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1508,7 +1513,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1587,7 +1592,7 @@ def get(self, **kwargs: Any) -> Dict[str, Any]: "str": {} # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1681,7 +1686,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1765,7 +1770,7 @@ def get(self, **kwargs: Any) -> Dict[str, _models.InnerModel]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1864,7 +1869,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1948,7 +1953,7 @@ def get(self, **kwargs: Any) -> Dict[str, _models.InnerModel]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2047,7 +2052,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2126,7 +2131,7 @@ def get(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2220,7 +2225,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/README.md b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/README.md index d87c2ac6a78..646a8c3ec3e 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-enum-extensible diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py index 702a3dad882..7a240cda2ad 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ build_string_put_unknown_value_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def get_known_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekE :rtype: str or ~typetest.enum.extensible.models.DaysOfWeekExtensibleEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -110,7 +115,7 @@ async def get_unknown_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWee :rtype: str or ~typetest.enum.extensible.models.DaysOfWeekExtensibleEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +170,7 @@ async def put_known_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,7 +223,7 @@ async def put_unknown_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py index 93ac2b5d43a..5a318b8144f 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,13 +69,12 @@ def build_string_get_unknown_value_request(**kwargs: Any) -> HttpRequest: def build_string_put_known_value_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/enum/extensible/string/known-value" # 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) @@ -78,13 +82,12 @@ def build_string_put_known_value_request(**kwargs: Any) -> HttpRequest: def build_string_put_unknown_value_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/enum/extensible/string/unknown-value" # 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) @@ -114,7 +117,7 @@ def get_known_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekExtensi :rtype: str or ~typetest.enum.extensible.models.DaysOfWeekExtensibleEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +167,7 @@ def get_unknown_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekExten :rtype: str or ~typetest.enum.extensible.models.DaysOfWeekExtensibleEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +222,7 @@ def put_known_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -272,7 +275,7 @@ def put_unknown_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/README.md b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/README.md index 890841b1ef3..4d463d20813 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-enum-fixed diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py index ad6fd58d0a4..0409b987dda 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_string_put_unknown_value_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def get_known_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekE :rtype: str or ~typetest.enum.fixed.models.DaysOfWeekEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +119,7 @@ async def put_known_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +172,7 @@ async def put_unknown_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py index 4bc4af99a85..48a555847d4 100644 --- a/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,13 +55,12 @@ def build_string_get_known_value_request(**kwargs: Any) -> HttpRequest: def build_string_put_known_value_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/enum/fixed/string/known-value" # 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) @@ -64,13 +68,12 @@ def build_string_put_known_value_request(**kwargs: Any) -> HttpRequest: def build_string_put_unknown_value_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/enum/fixed/string/unknown-value" # 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) @@ -100,7 +103,7 @@ def get_known_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekEnum]: :rtype: str or ~typetest.enum.fixed.models.DaysOfWeekEnum :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,7 +158,7 @@ def put_known_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +211,7 @@ def put_unknown_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-empty/README.md b/packages/typespec-python/test/azure/generated/typetest-model-empty/README.md index 024dc9b9049..13436f53ae1 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-empty/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-empty/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-model-empty diff --git a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py index 68b7782789f..2e9df5904df 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -79,9 +79,9 @@ def build_empty_post_round_trip_empty_request(**kwargs: Any) -> HttpRequest: # _url = "/type/model/empty/round-trip" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -159,7 +159,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,7 +212,7 @@ def get_empty(self, **kwargs: Any) -> _models.EmptyOutput: :rtype: ~typetest.model.empty.models.EmptyOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +326,7 @@ def post_round_trip_empty( # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py index e22acc6bbc0..530344b1e36 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -115,7 +115,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +168,7 @@ async def get_empty(self, **kwargs: Any) -> _models.EmptyOutput: :rtype: ~typetest.model.empty.models.EmptyOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -282,7 +282,7 @@ async def post_round_trip_empty( # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/README.md b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/README.md index dec0510c6c6..b5a04356ccb 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-model-enumdiscriminator diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py index 94d99e00049..9313aedd6ec 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -189,7 +189,7 @@ def get_extensible_model(self, **kwargs: Any) -> _models.Dog: # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +321,7 @@ def put_extensible_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +389,7 @@ def get_extensible_model_missing_discriminator(self, **kwargs: Any) -> _models.D # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,7 +454,7 @@ def get_extensible_model_wrong_discriminator(self, **kwargs: Any) -> _models.Dog # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,7 +519,7 @@ def get_fixed_model(self, **kwargs: Any) -> _models.Snake: # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -651,7 +651,7 @@ def put_fixed_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -719,7 +719,7 @@ def get_fixed_model_missing_discriminator(self, **kwargs: Any) -> _models.Snake: # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -784,7 +784,7 @@ def get_fixed_model_wrong_discriminator(self, **kwargs: Any) -> _models.Snake: # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py index 18f0a0aa5b5..c34a07597d2 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -71,7 +71,7 @@ async def get_extensible_model(self, **kwargs: Any) -> _models.Dog: # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -203,7 +203,7 @@ async def put_extensible_model( # pylint: disable=inconsistent-return-statement # JSON input template you can fill out and use as your body input. input = dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +273,7 @@ async def get_extensible_model_missing_discriminator( # pylint: disable=name-to # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,7 +338,7 @@ async def get_extensible_model_wrong_discriminator(self, **kwargs: Any) -> _mode # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -403,7 +403,7 @@ async def get_fixed_model(self, **kwargs: Any) -> _models.Snake: # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -535,7 +535,7 @@ async def put_fixed_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -603,7 +603,7 @@ async def get_fixed_model_missing_discriminator(self, **kwargs: Any) -> _models. # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -668,7 +668,7 @@ async def get_fixed_model_wrong_discriminator(self, **kwargs: Any) -> _models.Sn # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/README.md b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/README.md index 5be2967d668..147aba5cdf9 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-model-nesteddiscriminator diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py index 5f3733b6603..4ab7037f805 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -176,7 +176,7 @@ def get_model(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +346,7 @@ def put_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +433,7 @@ def get_recursive_model(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -603,7 +603,7 @@ def put_recursive_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -690,7 +690,7 @@ def get_missing_discriminator(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +774,7 @@ def get_wrong_discriminator(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py index ab110952fe8..77c93246e6c 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -88,7 +88,7 @@ async def get_model(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +258,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -345,7 +345,7 @@ async def get_recursive_model(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +515,7 @@ async def put_recursive_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -602,7 +602,7 @@ async def get_missing_discriminator(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -686,7 +686,7 @@ async def get_wrong_discriminator(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_models.py b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_models.py index 16a900c3ca2..5ea1b12a4ab 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_models.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_models.py @@ -25,24 +25,24 @@ class Fish(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar age: Required. - :vartype age: int :ivar kind: Required. Default value is None. :vartype kind: str + :ivar age: Required. + :vartype age: int """ __mapping__: Dict[str, _model_base.Model] = {} - age: int = rest_field() - """Required.""" kind: str = rest_discriminator(name="kind") """Required. Default value is None.""" + age: int = rest_field() + """Required.""" @overload def __init__( self, *, - age: int, kind: str, + age: int, ): ... diff --git a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/README.md b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/README.md index 686bce9e31c..215be22d431 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-model-notdiscriminated diff --git a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py index d0bcabeaa80..f2baf57c55c 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -79,9 +79,9 @@ def build_not_discriminated_put_valid_request(**kwargs: Any) -> HttpRequest: # _url = "/type/model/inheritance/not-discriminated/valid" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, headers=_headers, **kwargs) @@ -167,7 +167,7 @@ def post_valid( # pylint: disable=inconsistent-return-statements "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -230,7 +230,7 @@ def get_valid(self, **kwargs: Any) -> _models.Siamese: "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -380,7 +380,7 @@ def put_valid(self, input: Union[_models.Siamese, JSON, IO[bytes]], **kwargs: An "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py index 0a1cef575a6..a2eb43913d1 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -123,7 +123,7 @@ async def post_valid( # pylint: disable=inconsistent-return-statements "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +186,7 @@ async def get_valid(self, **kwargs: Any) -> _models.Siamese: "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -338,7 +338,7 @@ async def put_valid(self, input: Union[_models.Siamese, JSON, IO[bytes]], **kwar "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-recursive/README.md b/packages/typespec-python/test/azure/generated/typetest-model-recursive/README.md index eccfd00c10f..87540174157 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-recursive/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-recursive/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-model-recursive diff --git a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py index 99b863618c2..16571b0ffa6 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -152,7 +152,7 @@ def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +216,7 @@ def get(self, **kwargs: Any) -> _models.Extension: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py index 1f5a29e39d0..399ef599743 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -121,7 +121,7 @@ async def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +185,7 @@ async def get(self, **kwargs: Any) -> _models.Extension: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/README.md b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/README.md index a21c9b3f518..1389647f068 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-model-singlediscriminator diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py index 400366fef84..44029cd96a6 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -196,7 +196,7 @@ def get_model(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +378,7 @@ def put_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -471,7 +471,7 @@ def get_recursive_model(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -653,7 +653,7 @@ def put_recursive_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -746,7 +746,7 @@ def get_missing_discriminator(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,7 +836,7 @@ def get_wrong_discriminator(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -901,7 +901,7 @@ def get_legacy_model(self, **kwargs: Any) -> _models.Dinosaur: # response body for status code(s): 200 response == dinosaur """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py index fb3e7eaaa1f..e2b629ba054 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -95,7 +95,7 @@ async def get_model(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +277,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -370,7 +370,7 @@ async def get_recursive_model(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -552,7 +552,7 @@ async def put_recursive_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -645,7 +645,7 @@ async def get_missing_discriminator(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +735,7 @@ async def get_wrong_discriminator(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -800,7 +800,7 @@ async def get_legacy_model(self, **kwargs: Any) -> _models.Dinosaur: # response body for status code(s): 200 response == dinosaur """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_models.py b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_models.py index 580386c87a4..8a347721592 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_models.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_models.py @@ -66,24 +66,24 @@ class Dinosaur(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar size: Required. - :vartype size: int :ivar kind: Required. Default value is None. :vartype kind: str + :ivar size: Required. + :vartype size: int """ __mapping__: Dict[str, _model_base.Model] = {} - size: int = rest_field() - """Required.""" kind: str = rest_discriminator(name="kind") """Required. Default value is None.""" + size: int = rest_field() + """Required.""" @overload def __init__( self, *, - size: int, kind: str, + size: int, ): ... diff --git a/packages/typespec-python/test/azure/generated/typetest-model-usage/README.md b/packages/typespec-python/test/azure/generated/typetest-model-usage/README.md index 3d23299fba3..fae75217c80 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-usage/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-usage/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-model-usage diff --git a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py index d9f3d35d25e..707b73df239 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -79,9 +79,9 @@ def build_usage_input_and_output_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/usage/input-output" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -163,7 +163,7 @@ def input( # pylint: disable=inconsistent-return-statements "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +224,7 @@ def output(self, **kwargs: Any) -> _models.OutputRecord: "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +368,7 @@ def input_and_output( "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py index c74c5171d7e..53040bc1104 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -119,7 +119,7 @@ async def input( # pylint: disable=inconsistent-return-statements "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +180,7 @@ async def output(self, **kwargs: Any) -> _models.OutputRecord: "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +324,7 @@ async def input_and_output( "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-visibility/README.md b/packages/typespec-python/test/azure/generated/typetest-model-visibility/README.md index c3d2f4ac100..dab0204dd64 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-visibility/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-model-visibility/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-model-visibility diff --git a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py index 45aea8ce5a4..a32712bcbd4 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -51,9 +51,9 @@ def build_visibility_get_model_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/visibility" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="GET", url=_url, headers=_headers, **kwargs) @@ -291,7 +291,7 @@ def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +433,7 @@ def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes]], **k ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,7 +575,7 @@ def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +716,7 @@ def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +857,7 @@ def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -998,7 +998,7 @@ def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py index f9ad94fe211..66dd2f5ea2c 100644 --- a/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -208,7 +208,7 @@ async def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +350,7 @@ async def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes] ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +492,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +633,7 @@ async def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +774,7 @@ async def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -915,7 +915,7 @@ async def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/README.md b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/README.md index 27b17628941..25d305a17d6 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-property-additionalproperties diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py index 9bc2107f176..886d9e3ec2a 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -100,7 +100,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalProperties "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,7 +220,7 @@ async def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +303,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalProperties "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -433,7 +433,7 @@ async def put( # pylint: disable=inconsistent-return-statements "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -523,7 +523,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalProperties # response body for status code(s): 200 response == extends_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -667,7 +667,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = extends_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -747,7 +747,7 @@ async def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -867,7 +867,7 @@ async def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -949,7 +949,7 @@ async def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalPropertiesDeriv "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1077,7 +1077,7 @@ async def put( # pylint: disable=inconsistent-return-statements "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1167,7 +1167,7 @@ async def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalPropertiesDiscr # response body for status code(s): 200 response == is_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1311,7 +1311,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = is_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1391,7 +1391,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsStringAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1511,7 +1511,7 @@ async def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1591,7 +1591,7 @@ async def get(self, **kwargs: Any) -> _models.IsStringAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1711,7 +1711,7 @@ async def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1791,7 +1791,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsFloatAdditionalProperties: "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1911,7 +1911,7 @@ async def put( # pylint: disable=inconsistent-return-statements "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1991,7 +1991,7 @@ async def get(self, **kwargs: Any) -> _models.IsFloatAdditionalProperties: "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2111,7 +2111,7 @@ async def put( # pylint: disable=inconsistent-return-statements "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2183,7 +2183,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsModelAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.ExtendsModelAdditionalProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2299,7 +2299,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2371,7 +2371,7 @@ async def get(self, **kwargs: Any) -> _models.IsModelAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.IsModelAdditionalProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2487,7 +2487,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2559,7 +2559,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsModelArrayAdditionalPropert :rtype: ~typetest.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2681,7 +2681,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2753,7 +2753,7 @@ async def get(self, **kwargs: Any) -> _models.IsModelArrayAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.IsModelArrayAdditionalProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2869,7 +2869,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py index cd9fcf882a0..f487fb06db4 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -466,7 +466,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -586,7 +586,7 @@ def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -669,7 +669,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalPropertiesDerive "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -799,7 +799,7 @@ def put( # pylint: disable=inconsistent-return-statements "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -889,7 +889,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalPropertiesDiscri # response body for status code(s): 200 response == extends_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1033,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = extends_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1113,7 +1113,7 @@ def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1233,7 +1233,7 @@ def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1315,7 +1315,7 @@ def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalPropertiesDerived: "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1443,7 +1443,7 @@ def put( # pylint: disable=inconsistent-return-statements "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1533,7 +1533,7 @@ def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalPropertiesDiscriminat # response body for status code(s): 200 response == is_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1677,7 +1677,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = is_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1757,7 +1757,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsStringAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1877,7 +1877,7 @@ def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1957,7 +1957,7 @@ def get(self, **kwargs: Any) -> _models.IsStringAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2077,7 +2077,7 @@ def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2157,7 +2157,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsFloatAdditionalProperties: "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2277,7 +2277,7 @@ def put( # pylint: disable=inconsistent-return-statements "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2357,7 +2357,7 @@ def get(self, **kwargs: Any) -> _models.IsFloatAdditionalProperties: "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2477,7 +2477,7 @@ def put( # pylint: disable=inconsistent-return-statements "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2549,7 +2549,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsModelAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.ExtendsModelAdditionalProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2665,7 +2665,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2737,7 +2737,7 @@ def get(self, **kwargs: Any) -> _models.IsModelAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.IsModelAdditionalProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2853,7 +2853,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2925,7 +2925,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsModelArrayAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3047,7 +3047,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3119,7 +3119,7 @@ def get(self, **kwargs: Any) -> _models.IsModelArrayAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.IsModelArrayAdditionalProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3235,7 +3235,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-property-nullable/README.md b/packages/typespec-python/test/azure/generated/typetest-property-nullable/README.md index 9fb8f7c86df..53deb974893 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-nullable/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-property-nullable/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-property-nullable diff --git a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py index ab2fa373690..324234d4541 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -96,7 +96,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.StringProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,7 +155,7 @@ async def get_null(self, **kwargs: Any) -> _models.StringProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +275,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +398,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -478,7 +478,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.BytesProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -537,7 +537,7 @@ async def get_null(self, **kwargs: Any) -> _models.BytesProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -657,7 +657,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -780,7 +780,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -860,7 +860,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.DatetimeProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -919,7 +919,7 @@ async def get_null(self, **kwargs: Any) -> _models.DatetimeProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1039,7 +1039,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1162,7 +1162,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1242,7 +1242,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.DurationProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1301,7 +1301,7 @@ async def get_null(self, **kwargs: Any) -> _models.DurationProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1421,7 +1421,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1544,7 +1544,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1626,7 +1626,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.CollectionsByteProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1687,7 +1687,7 @@ async def get_null(self, **kwargs: Any) -> _models.CollectionsByteProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1815,7 +1815,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1946,7 +1946,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2031,7 +2031,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.CollectionsModelProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2095,7 +2095,7 @@ async def get_null(self, **kwargs: Any) -> _models.CollectionsModelProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2227,7 +2227,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2362,7 +2362,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py index b57a1e80ee8..9af8b4fec95 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -410,7 +410,7 @@ def get_non_null(self, **kwargs: Any) -> _models.StringProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +469,7 @@ def get_null(self, **kwargs: Any) -> _models.StringProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +589,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -712,7 +712,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -792,7 +792,7 @@ def get_non_null(self, **kwargs: Any) -> _models.BytesProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -851,7 +851,7 @@ def get_null(self, **kwargs: Any) -> _models.BytesProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -971,7 +971,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1094,7 +1094,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1174,7 +1174,7 @@ def get_non_null(self, **kwargs: Any) -> _models.DatetimeProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1233,7 +1233,7 @@ def get_null(self, **kwargs: Any) -> _models.DatetimeProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1353,7 +1353,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1476,7 +1476,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1556,7 +1556,7 @@ def get_non_null(self, **kwargs: Any) -> _models.DurationProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1615,7 +1615,7 @@ def get_null(self, **kwargs: Any) -> _models.DurationProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1735,7 +1735,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1858,7 +1858,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1940,7 +1940,7 @@ def get_non_null(self, **kwargs: Any) -> _models.CollectionsByteProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2001,7 +2001,7 @@ def get_null(self, **kwargs: Any) -> _models.CollectionsByteProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2129,7 +2129,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2260,7 +2260,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2345,7 +2345,7 @@ def get_non_null(self, **kwargs: Any) -> _models.CollectionsModelProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2409,7 +2409,7 @@ def get_null(self, **kwargs: Any) -> _models.CollectionsModelProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2541,7 +2541,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2676,7 +2676,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/README.md b/packages/typespec-python/test/azure/generated/typetest-property-optional/README.md index 98d73b59a0c..9467e0ad02d 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-property-optional diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py index de0cf24248e..c1b46d845a1 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -127,7 +127,7 @@ async def get_all(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +185,7 @@ async def get_default(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +303,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +424,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -503,7 +503,7 @@ async def get_all(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -561,7 +561,7 @@ async def get_default(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,7 +679,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -800,7 +800,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +879,7 @@ async def get_all(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -937,7 +937,7 @@ async def get_default(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1055,7 +1055,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1176,7 +1176,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1255,7 +1255,7 @@ async def get_all(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1313,7 +1313,7 @@ async def get_default(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1431,7 +1431,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1552,7 +1552,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1633,7 +1633,7 @@ async def get_all(self, **kwargs: Any) -> _models.CollectionsByteProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1693,7 +1693,7 @@ async def get_default(self, **kwargs: Any) -> _models.CollectionsByteProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1815,7 +1815,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1940,7 +1940,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2024,7 +2024,7 @@ async def get_all(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2087,7 +2087,7 @@ async def get_default(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2213,7 +2213,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2342,7 +2342,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2421,7 +2421,7 @@ async def get_all(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2479,7 +2479,7 @@ async def get_default(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2597,7 +2597,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2718,7 +2718,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2797,7 +2797,7 @@ async def get_all(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2855,7 +2855,7 @@ async def get_default(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2973,7 +2973,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3094,7 +3094,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3170,10 +3170,10 @@ async def get_all(self, **kwargs: Any) -> _models.FloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3228,10 +3228,10 @@ async def get_default(self, **kwargs: Any) -> _models.FloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3293,7 +3293,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ @@ -3346,10 +3346,10 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3414,7 +3414,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ @@ -3467,10 +3467,10 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3549,7 +3549,7 @@ async def get_all(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3607,7 +3607,7 @@ async def get_default(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3725,7 +3725,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3846,7 +3846,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3911,6 +3911,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get models that will return all properties in the model. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -3923,11 +3924,11 @@ async def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3971,6 +3972,7 @@ async def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: @distributed_trace_async async def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get models that will return the default object. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -3983,11 +3985,11 @@ async def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty # response body for status code(s): 200 response == { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4033,6 +4035,7 @@ async def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty async def put_all( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with all properties present. :param body: Required. @@ -4049,8 +4052,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -4090,6 +4093,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements async def put_all( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with all properties present. :param body: Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -4104,11 +4108,11 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4157,6 +4161,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements async def put_default( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with default properties. :param body: Required. @@ -4173,8 +4178,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -4214,6 +4219,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements async def put_default( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with default properties. :param body: Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -4228,11 +4234,11 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4308,10 +4314,11 @@ async def get_all(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4366,10 +4373,11 @@ async def get_default(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4431,7 +4439,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ @@ -4484,10 +4493,11 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4552,7 +4562,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ @@ -4605,10 +4616,11 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4685,10 +4697,11 @@ async def get_all(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4744,10 +4757,11 @@ async def get_default(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4809,7 +4823,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ @@ -4863,10 +4878,11 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4931,7 +4947,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ @@ -4985,10 +5002,11 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5069,7 +5087,7 @@ async def get_all(self, **kwargs: Any) -> _models.RequiredAndOptionalProperty: "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5129,7 +5147,7 @@ async def get_required_only(self, **kwargs: Any) -> _models.RequiredAndOptionalP "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5250,7 +5268,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5374,7 +5392,7 @@ async def put_required_only( # pylint: disable=inconsistent-return-statements "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/__init__.py b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/__init__.py index 3574f9d7074..deb3f98d8bf 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/__init__.py @@ -20,10 +20,6 @@ from ._models import UnionFloatLiteralProperty from ._models import UnionIntLiteralProperty from ._models import UnionStringLiteralProperty - -from ._enums import UnionFloatLiteralPropertyProperty -from ._enums import UnionIntLiteralPropertyProperty -from ._enums import UnionStringLiteralPropertyProperty from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -43,9 +39,6 @@ "UnionFloatLiteralProperty", "UnionIntLiteralProperty", "UnionStringLiteralProperty", - "UnionFloatLiteralPropertyProperty", - "UnionIntLiteralPropertyProperty", - "UnionStringLiteralPropertyProperty", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/_models.py b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/_models.py index b132841a1ce..c7f77d722e9 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/_models.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/models/_models.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload +from typing import Any, List, Literal, Mapping, Optional, TYPE_CHECKING, overload from .. import _model_base from .._model_base import rest_field @@ -196,12 +196,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class FloatLiteralProperty(_model_base.Model): """Model with float literal property. - :ivar property: Property. Default value is 1.2. + :ivar property: Property. Default value is 1.25. :vartype property: float """ property: Optional[float] = rest_field() - """Property. Default value is 1.2.""" + """Property. Default value is 1.25.""" @overload def __init__( @@ -349,21 +349,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class UnionFloatLiteralProperty(_model_base.Model): """Model with union of float literal property. - :ivar property: Property. Known values are: 1.2 and 2.3. - :vartype property: float or - ~typetest.property.optional.models.UnionFloatLiteralPropertyProperty + :ivar property: Property. Is either a float type or a float type. + :vartype property: float or float """ - property: Optional[Union[float, "_models.UnionFloatLiteralPropertyProperty"]] = rest_field() - """Property. Known values are: 1.2 and 2.3.""" + property: Optional[float] = rest_field() + """Property. Is either a float type or a float type.""" @overload def __init__( self, *, - property: Optional[ - Union[float, "_models.UnionFloatLiteralPropertyProperty"] - ] = None, # pylint: disable=redefined-builtin + property: Optional[float] = None, # pylint: disable=redefined-builtin ): ... @@ -381,20 +378,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class UnionIntLiteralProperty(_model_base.Model): """Model with union of int literal property. - :ivar property: Property. Known values are: 1 and 2. - :vartype property: int or ~typetest.property.optional.models.UnionIntLiteralPropertyProperty + :ivar property: Property. Is either a Literal[1] type or a Literal[2] type. + :vartype property: int or int """ - property: Optional[Union[int, "_models.UnionIntLiteralPropertyProperty"]] = rest_field() - """Property. Known values are: 1 and 2.""" + property: Optional[Literal[1, 2]] = rest_field() + """Property. Is either a Literal[1] type or a Literal[2] type.""" @overload def __init__( self, *, - property: Optional[ - Union[int, "_models.UnionIntLiteralPropertyProperty"] - ] = None, # pylint: disable=redefined-builtin + property: Optional[Literal[1, 2]] = None, # pylint: disable=redefined-builtin ): ... @@ -412,20 +407,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class UnionStringLiteralProperty(_model_base.Model): """Model with union of string literal property. - :ivar property: Property. Known values are: "hello" and "world". - :vartype property: str or ~typetest.property.optional.models.UnionStringLiteralPropertyProperty + :ivar property: Property. Is either a Literal["hello"] type or a Literal["world"] type. + :vartype property: str or str """ - property: Optional[Union[str, "_models.UnionStringLiteralPropertyProperty"]] = rest_field() - """Property. Known values are: \"hello\" and \"world\".""" + property: Optional[Literal["hello", "world"]] = rest_field() + """Property. Is either a Literal[\"hello\"] type or a Literal[\"world\"] type.""" @overload def __init__( self, *, - property: Optional[ - Union[str, "_models.UnionStringLiteralPropertyProperty"] - ] = None, # pylint: disable=redefined-builtin + property: Optional[Literal["hello", "world"]] = None, # pylint: disable=redefined-builtin ): ... diff --git a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py index f7b8dadd39e..2434b2fa2f8 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -861,7 +861,7 @@ def get_all(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -919,7 +919,7 @@ def get_default(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1037,7 +1037,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1158,7 +1158,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1237,7 +1237,7 @@ def get_all(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1295,7 +1295,7 @@ def get_default(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1413,7 +1413,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1534,7 +1534,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1613,7 +1613,7 @@ def get_all(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1671,7 +1671,7 @@ def get_default(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1789,7 +1789,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1910,7 +1910,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1989,7 +1989,7 @@ def get_all(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2047,7 +2047,7 @@ def get_default(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2165,7 +2165,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2286,7 +2286,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2367,7 +2367,7 @@ def get_all(self, **kwargs: Any) -> _models.CollectionsByteProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2427,7 +2427,7 @@ def get_default(self, **kwargs: Any) -> _models.CollectionsByteProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2549,7 +2549,7 @@ def put_all( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2674,7 +2674,7 @@ def put_default( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2758,7 +2758,7 @@ def get_all(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2821,7 +2821,7 @@ def get_default(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2947,7 +2947,7 @@ def put_all( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3076,7 +3076,7 @@ def put_default( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3155,7 +3155,7 @@ def get_all(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3213,7 +3213,7 @@ def get_default(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3331,7 +3331,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3452,7 +3452,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3531,7 +3531,7 @@ def get_all(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3589,7 +3589,7 @@ def get_default(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3707,7 +3707,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3828,7 +3828,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3904,10 +3904,10 @@ def get_all(self, **kwargs: Any) -> _models.FloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3962,10 +3962,10 @@ def get_default(self, **kwargs: Any) -> _models.FloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4027,7 +4027,7 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ @@ -4080,10 +4080,10 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4148,7 +4148,7 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ @@ -4201,10 +4201,10 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4283,7 +4283,7 @@ def get_all(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4341,7 +4341,7 @@ def get_default(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4459,7 +4459,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4580,7 +4580,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4645,6 +4645,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get models that will return all properties in the model. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -4657,11 +4658,11 @@ def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4705,6 +4706,7 @@ def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: @distributed_trace def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get models that will return the default object. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -4717,11 +4719,11 @@ def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4767,6 +4769,7 @@ def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: def put_all( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with all properties present. :param body: Required. @@ -4783,8 +4786,8 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -4824,6 +4827,7 @@ def put_all( # pylint: disable=inconsistent-return-statements def put_all( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with all properties present. :param body: Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -4838,11 +4842,11 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4891,6 +4895,7 @@ def put_all( # pylint: disable=inconsistent-return-statements def put_default( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with default properties. :param body: Required. @@ -4907,8 +4912,8 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -4948,6 +4953,7 @@ def put_default( # pylint: disable=inconsistent-return-statements def put_default( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with default properties. :param body: Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -4962,11 +4968,11 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5042,10 +5048,11 @@ def get_all(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5100,10 +5107,11 @@ def get_default(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5165,7 +5173,8 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ @@ -5218,10 +5227,11 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5286,7 +5296,8 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ @@ -5339,10 +5350,11 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5419,10 +5431,11 @@ def get_all(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5478,10 +5491,11 @@ def get_default(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5543,7 +5557,8 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ @@ -5597,10 +5612,11 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5665,7 +5681,8 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ @@ -5719,10 +5736,11 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5803,7 +5821,7 @@ def get_all(self, **kwargs: Any) -> _models.RequiredAndOptionalProperty: "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5863,7 +5881,7 @@ def get_required_only(self, **kwargs: Any) -> _models.RequiredAndOptionalPropert "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5984,7 +6002,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6108,7 +6126,7 @@ def put_required_only( # pylint: disable=inconsistent-return-statements "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/README.md b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/README.md index 27fba352159..57072e646d1 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-property-valuetypes diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_client.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_client.py index 98385b2943f..86d5599e052 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_client.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/_client.py @@ -37,6 +37,7 @@ NeverOperations, StringLiteralOperations, StringOperations, + UnionEnumValueOperations, UnionFloatLiteralOperations, UnionIntLiteralOperations, UnionStringLiteralOperations, @@ -109,6 +110,8 @@ class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,to :ivar union_float_literal: UnionFloatLiteralOperations operations :vartype union_float_literal: typetest.property.valuetypes.operations.UnionFloatLiteralOperations + :ivar union_enum_value: UnionEnumValueOperations operations + :vartype union_enum_value: typetest.property.valuetypes.operations.UnionEnumValueOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -179,6 +182,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.union_float_literal = UnionFloatLiteralOperations( self._client, self._config, self._serialize, self._deserialize ) + self.union_enum_value = UnionEnumValueOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py index 8259c2b9e69..ae5a182c9f0 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py @@ -37,6 +37,7 @@ NeverOperations, StringLiteralOperations, StringOperations, + UnionEnumValueOperations, UnionFloatLiteralOperations, UnionIntLiteralOperations, UnionStringLiteralOperations, @@ -112,6 +113,8 @@ class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,to :ivar union_float_literal: UnionFloatLiteralOperations operations :vartype union_float_literal: typetest.property.valuetypes.aio.operations.UnionFloatLiteralOperations + :ivar union_enum_value: UnionEnumValueOperations operations + :vartype union_enum_value: typetest.property.valuetypes.aio.operations.UnionEnumValueOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -182,6 +185,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.union_float_literal = UnionFloatLiteralOperations( self._client, self._config, self._serialize, self._deserialize ) + self.union_enum_value = UnionEnumValueOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/__init__.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/__init__.py index e3d8c808b7a..6b43bd6ef00 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/__init__.py @@ -34,6 +34,7 @@ from ._operations import UnionStringLiteralOperations from ._operations import UnionIntLiteralOperations from ._operations import UnionFloatLiteralOperations +from ._operations import UnionEnumValueOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -68,6 +69,7 @@ "UnionStringLiteralOperations", "UnionIntLiteralOperations", "UnionFloatLiteralOperations", + "UnionEnumValueOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py index 9dbdfc6f201..11409f2c7d5 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -69,6 +69,8 @@ build_string_literal_get_request, build_string_literal_put_request, build_string_put_request, + build_union_enum_value_get_request, + build_union_enum_value_put_request, build_union_float_literal_get_request, build_union_float_literal_put_request, build_union_int_literal_get_request, @@ -127,7 +129,7 @@ async def get(self, **kwargs: Any) -> _models.BooleanProperty: "property": bool # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +247,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": bool # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,7 +326,7 @@ async def get(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +444,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": "str" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,7 +523,7 @@ async def get(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,7 +641,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,7 +720,7 @@ async def get(self, **kwargs: Any) -> _models.IntProperty: "property": 0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -836,7 +838,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -915,7 +917,7 @@ async def get(self, **kwargs: Any) -> _models.FloatProperty: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1035,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1112,7 +1114,7 @@ async def get(self, **kwargs: Any) -> _models.DecimalProperty: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1230,7 +1232,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1309,7 +1311,7 @@ async def get(self, **kwargs: Any) -> _models.Decimal128Property: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1427,7 +1429,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1506,7 +1508,7 @@ async def get(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1624,7 +1626,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1703,7 +1705,7 @@ async def get(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1821,7 +1823,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1901,7 +1903,7 @@ async def get(self, **kwargs: Any) -> _models.EnumProperty: "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2021,7 +2023,7 @@ async def put( # pylint: disable=inconsistent-return-statements "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2101,7 +2103,7 @@ async def get(self, **kwargs: Any) -> _models.ExtensibleEnumProperty: "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2222,7 +2224,7 @@ async def put( # pylint: disable=inconsistent-return-statements "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2303,7 +2305,7 @@ async def get(self, **kwargs: Any) -> _models.ModelProperty: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2425,7 +2427,7 @@ async def put( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2507,7 +2509,7 @@ async def get(self, **kwargs: Any) -> _models.CollectionsStringProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2630,7 +2632,7 @@ async def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2711,7 +2713,7 @@ async def get(self, **kwargs: Any) -> _models.CollectionsIntProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2834,7 +2836,7 @@ async def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2918,7 +2920,7 @@ async def get(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3045,7 +3047,7 @@ async def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3127,7 +3129,7 @@ async def get(self, **kwargs: Any) -> _models.DictionaryStringProperty: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3250,7 +3252,7 @@ async def put( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3321,7 +3323,7 @@ async def get(self, **kwargs: Any) -> _models.NeverProperty: :rtype: ~typetest.property.valuetypes.models.NeverProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3435,7 +3437,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3514,7 +3516,7 @@ async def get(self, **kwargs: Any) -> _models.UnknownStringProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3633,7 +3635,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3712,7 +3714,7 @@ async def get(self, **kwargs: Any) -> _models.UnknownIntProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3830,7 +3832,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3909,7 +3911,7 @@ async def get(self, **kwargs: Any) -> _models.UnknownDictProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4028,7 +4030,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4107,7 +4109,7 @@ async def get(self, **kwargs: Any) -> _models.UnknownArrayProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4226,7 +4228,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4305,7 +4307,7 @@ async def get(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Default value is "hello". Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4424,7 +4426,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": "hello" # Default value is "hello". Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4503,7 +4505,7 @@ async def get(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 42 # Default value is 42. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4621,7 +4623,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 42 # Default value is 42. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4700,7 +4702,7 @@ async def get(self, **kwargs: Any) -> _models.FloatLiteralProperty: "property": 43.125 # Default value is 43.125. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4819,7 +4821,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 43.125 # Default value is 43.125. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4898,7 +4900,7 @@ async def get(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Default value is True. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5017,7 +5019,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": True # Default value is True. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5082,6 +5084,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get call. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -5094,11 +5097,11 @@ async def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5144,6 +5147,7 @@ async def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: async def put( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put operation. :param body: body. Required. @@ -5160,8 +5164,8 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -5201,6 +5205,7 @@ async def put( # pylint: disable=inconsistent-return-statements async def put( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put operation. :param body: body. Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -5216,11 +5221,11 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5296,10 +5301,11 @@ async def get(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5361,7 +5367,8 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ @@ -5415,10 +5422,11 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5495,10 +5503,11 @@ async def get(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5560,7 +5569,8 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ @@ -5614,10 +5624,11 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5661,3 +5672,201 @@ async def put( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore + + +class UnionEnumValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~typetest.property.valuetypes.aio.ValueTypesClient`'s + :attr:`union_enum_value` attribute. + """ + + 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(self, **kwargs: Any) -> _models.UnionEnumValueProperty: + """Get call. + + :return: UnionEnumValueProperty. The UnionEnumValueProperty is compatible with MutableMapping + :rtype: ~typetest.property.valuetypes.models.UnionEnumValueProperty + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "property": "str" # Property. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.UnionEnumValueProperty] = kwargs.pop("cls", None) + + _request = build_union_enum_value_get_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.UnionEnumValueProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def put( # pylint: disable=inconsistent-return-statements + self, body: _models.UnionEnumValueProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: ~typetest.property.valuetypes.models.UnionEnumValueProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "property": "str" # Property. Required. + } + """ + + @overload + async def put( # pylint: disable=inconsistent-return-statements + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( # pylint: disable=inconsistent-return-statements + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def put( # pylint: disable=inconsistent-return-statements + self, body: Union[_models.UnionEnumValueProperty, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Is one of the following types: UnionEnumValueProperty, JSON, IO[bytes] + Required. + :type body: ~typetest.property.valuetypes.models.UnionEnumValueProperty or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "property": "str" # Property. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_value_put_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/__init__.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/__init__.py index 87e5fae54d7..a947a450044 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/__init__.py @@ -28,6 +28,7 @@ from ._models import NeverProperty from ._models import StringLiteralProperty from ._models import StringProperty +from ._models import UnionEnumValueProperty from ._models import UnionFloatLiteralProperty from ._models import UnionIntLiteralProperty from ._models import UnionStringLiteralProperty @@ -36,11 +37,9 @@ from ._models import UnknownIntProperty from ._models import UnknownStringProperty +from ._enums import ExtendedEnum from ._enums import FixedInnerEnum from ._enums import InnerEnum -from ._enums import UnionFloatLiteralPropertyProperty -from ._enums import UnionIntLiteralPropertyProperty -from ._enums import UnionStringLiteralPropertyProperty from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -68,6 +67,7 @@ "NeverProperty", "StringLiteralProperty", "StringProperty", + "UnionEnumValueProperty", "UnionFloatLiteralProperty", "UnionIntLiteralProperty", "UnionStringLiteralProperty", @@ -75,11 +75,9 @@ "UnknownDictProperty", "UnknownIntProperty", "UnknownStringProperty", + "ExtendedEnum", "FixedInnerEnum", "InnerEnum", - "UnionFloatLiteralPropertyProperty", - "UnionIntLiteralPropertyProperty", - "UnionStringLiteralPropertyProperty", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_enums.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_enums.py index 5a442cc14ff..e1ffa2bf06f 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_enums.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_enums.py @@ -10,6 +10,12 @@ from azure.core import CaseInsensitiveEnumMeta +class ExtendedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ExtendedEnum.""" + + ENUM_VALUE2 = "value2" + + class FixedInnerEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum that will be used as a property for model EnumProperty. Non-extensible.""" @@ -26,24 +32,3 @@ class InnerEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """First value.""" VALUE_TWO = "ValueTwo" """Second value.""" - - -class UnionFloatLiteralPropertyProperty(float, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionFloatLiteralPropertyProperty.""" - - ENUM_43_125 = 43.125 - ENUM_46_875 = 46.875 - - -class UnionIntLiteralPropertyProperty(int, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionIntLiteralPropertyProperty.""" - - ENUM_42 = 42 - ENUM_43 = 43 - - -class UnionStringLiteralPropertyProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionStringLiteralPropertyProperty.""" - - HELLO = "hello" - WORLD = "world" diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_models.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_models.py index 4bd9cbd85b1..2eac9a7b73b 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_models.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_models.py @@ -13,6 +13,7 @@ from .. import _model_base from .._model_base import rest_field +from ._enums import ExtendedEnum if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -626,24 +627,55 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class UnionEnumValueProperty(_model_base.Model): + """Template type for testing models with specific properties. Pass in the type of the property you + are looking for. + + All required parameters must be populated in order to send to server. + + :ivar property: Property. Required. + :vartype property: str or ~typetest.property.valuetypes.models.ENUM_VALUE2 + """ + + property: Literal[ExtendedEnum.ENUM_VALUE2] = rest_field() + """Property. Required.""" + + @overload + def __init__( + self, + *, + property: Literal[ExtendedEnum.ENUM_VALUE2], # pylint: disable=redefined-builtin + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class UnionFloatLiteralProperty(_model_base.Model): """Model with a union of float literal as property. All required parameters must be populated in order to send to server. - :ivar property: Property. Required. Known values are: 43.125 and 46.875. - :vartype property: float or - ~typetest.property.valuetypes.models.UnionFloatLiteralPropertyProperty + :ivar property: Property. Required. Is either a float type or a float type. + :vartype property: float or float """ - property: Union[float, "_models.UnionFloatLiteralPropertyProperty"] = rest_field() - """Property. Required. Known values are: 43.125 and 46.875.""" + property: float = rest_field() + """Property. Required. Is either a float type or a float type.""" @overload def __init__( self, *, - property: Union[float, "_models.UnionFloatLiteralPropertyProperty"], # pylint: disable=redefined-builtin + property: float, # pylint: disable=redefined-builtin ): ... @@ -663,18 +695,18 @@ class UnionIntLiteralProperty(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar property: Property. Required. Known values are: 42 and 43. - :vartype property: int or ~typetest.property.valuetypes.models.UnionIntLiteralPropertyProperty + :ivar property: Property. Required. Is either a Literal[42] type or a Literal[43] type. + :vartype property: int or int """ - property: Union[int, "_models.UnionIntLiteralPropertyProperty"] = rest_field() - """Property. Required. Known values are: 42 and 43.""" + property: Literal[42, 43] = rest_field() + """Property. Required. Is either a Literal[42] type or a Literal[43] type.""" @overload def __init__( self, *, - property: Union[int, "_models.UnionIntLiteralPropertyProperty"], # pylint: disable=redefined-builtin + property: Literal[42, 43], # pylint: disable=redefined-builtin ): ... @@ -694,19 +726,19 @@ class UnionStringLiteralProperty(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar property: Property. Required. Known values are: "hello" and "world". - :vartype property: str or - ~typetest.property.valuetypes.models.UnionStringLiteralPropertyProperty + :ivar property: Property. Required. Is either a Literal["hello"] type or a Literal["world"] + type. + :vartype property: str or str """ - property: Union[str, "_models.UnionStringLiteralPropertyProperty"] = rest_field() - """Property. Required. Known values are: \"hello\" and \"world\".""" + property: Literal["hello", "world"] = rest_field() + """Property. Required. Is either a Literal[\"hello\"] type or a Literal[\"world\"] type.""" @overload def __init__( self, *, - property: Union[str, "_models.UnionStringLiteralPropertyProperty"], # pylint: disable=redefined-builtin + property: Literal["hello", "world"], # pylint: disable=redefined-builtin ): ... diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/__init__.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/__init__.py index e3d8c808b7a..6b43bd6ef00 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/__init__.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/__init__.py @@ -34,6 +34,7 @@ from ._operations import UnionStringLiteralOperations from ._operations import UnionIntLiteralOperations from ._operations import UnionFloatLiteralOperations +from ._operations import UnionEnumValueOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -68,6 +69,7 @@ "UnionStringLiteralOperations", "UnionIntLiteralOperations", "UnionFloatLiteralOperations", + "UnionEnumValueOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py index f15ea640a91..f221997c839 100644 --- a/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -824,6 +824,34 @@ def build_union_float_literal_put_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) +def build_union_enum_value_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/type/property/value-types/union-enum-value" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_union_enum_value_put_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + # Construct URL + _url = "/type/property/value-types/union-enum-value" + + # 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) + + class BooleanOperations: """ .. warning:: @@ -857,7 +885,7 @@ def get(self, **kwargs: Any) -> _models.BooleanProperty: "property": bool # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -975,7 +1003,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": bool # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1054,7 +1082,7 @@ def get(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1172,7 +1200,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": "str" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1251,7 +1279,7 @@ def get(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1369,7 +1397,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1448,7 +1476,7 @@ def get(self, **kwargs: Any) -> _models.IntProperty: "property": 0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1566,7 +1594,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1645,7 +1673,7 @@ def get(self, **kwargs: Any) -> _models.FloatProperty: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1763,7 +1791,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1842,7 +1870,7 @@ def get(self, **kwargs: Any) -> _models.DecimalProperty: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1960,7 +1988,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2039,7 +2067,7 @@ def get(self, **kwargs: Any) -> _models.Decimal128Property: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2157,7 +2185,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2236,7 +2264,7 @@ def get(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2354,7 +2382,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2433,7 +2461,7 @@ def get(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2551,7 +2579,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2631,7 +2659,7 @@ def get(self, **kwargs: Any) -> _models.EnumProperty: "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2751,7 +2779,7 @@ def put( # pylint: disable=inconsistent-return-statements "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2831,7 +2859,7 @@ def get(self, **kwargs: Any) -> _models.ExtensibleEnumProperty: "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2952,7 +2980,7 @@ def put( # pylint: disable=inconsistent-return-statements "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3033,7 +3061,7 @@ def get(self, **kwargs: Any) -> _models.ModelProperty: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3155,7 +3183,7 @@ def put( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3237,7 +3265,7 @@ def get(self, **kwargs: Any) -> _models.CollectionsStringProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3360,7 +3388,7 @@ def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3441,7 +3469,7 @@ def get(self, **kwargs: Any) -> _models.CollectionsIntProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3564,7 +3592,7 @@ def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3648,7 +3676,7 @@ def get(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3775,7 +3803,7 @@ def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3857,7 +3885,7 @@ def get(self, **kwargs: Any) -> _models.DictionaryStringProperty: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3980,7 +4008,7 @@ def put( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4051,7 +4079,7 @@ def get(self, **kwargs: Any) -> _models.NeverProperty: :rtype: ~typetest.property.valuetypes.models.NeverProperty :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4165,7 +4193,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4244,7 +4272,7 @@ def get(self, **kwargs: Any) -> _models.UnknownStringProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4363,7 +4391,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4442,7 +4470,7 @@ def get(self, **kwargs: Any) -> _models.UnknownIntProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4560,7 +4588,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4639,7 +4667,7 @@ def get(self, **kwargs: Any) -> _models.UnknownDictProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4758,7 +4786,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4837,7 +4865,7 @@ def get(self, **kwargs: Any) -> _models.UnknownArrayProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4956,7 +4984,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5035,7 +5063,7 @@ def get(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Default value is "hello". Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5154,7 +5182,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": "hello" # Default value is "hello". Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5233,7 +5261,7 @@ def get(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 42 # Default value is 42. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5351,7 +5379,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 42 # Default value is 42. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5430,7 +5458,7 @@ def get(self, **kwargs: Any) -> _models.FloatLiteralProperty: "property": 43.125 # Default value is 43.125. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5549,7 +5577,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 43.125 # Default value is 43.125. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5628,7 +5656,7 @@ def get(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Default value is True. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5747,7 +5775,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": True # Default value is True. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5812,6 +5840,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get call. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -5824,11 +5853,11 @@ def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5874,6 +5903,7 @@ def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: def put( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put operation. :param body: body. Required. @@ -5890,8 +5920,8 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -5931,6 +5961,7 @@ def put( # pylint: disable=inconsistent-return-statements def put( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put operation. :param body: body. Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -5946,11 +5977,11 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6026,10 +6057,11 @@ def get(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6091,7 +6123,8 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ @@ -6145,10 +6178,11 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6225,10 +6259,11 @@ def get(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6290,7 +6325,8 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ @@ -6344,10 +6380,11 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6391,3 +6428,201 @@ def put( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore + + +class UnionEnumValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~typetest.property.valuetypes.ValueTypesClient`'s + :attr:`union_enum_value` attribute. + """ + + 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(self, **kwargs: Any) -> _models.UnionEnumValueProperty: + """Get call. + + :return: UnionEnumValueProperty. The UnionEnumValueProperty is compatible with MutableMapping + :rtype: ~typetest.property.valuetypes.models.UnionEnumValueProperty + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "property": "str" # Property. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.UnionEnumValueProperty] = kwargs.pop("cls", None) + + _request = build_union_enum_value_get_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.UnionEnumValueProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def put( # pylint: disable=inconsistent-return-statements + self, body: _models.UnionEnumValueProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: ~typetest.property.valuetypes.models.UnionEnumValueProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "property": "str" # Property. Required. + } + """ + + @overload + def put( # pylint: disable=inconsistent-return-statements + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( # pylint: disable=inconsistent-return-statements + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def put( # pylint: disable=inconsistent-return-statements + self, body: Union[_models.UnionEnumValueProperty, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Is one of the following types: UnionEnumValueProperty, JSON, IO[bytes] + Required. + :type body: ~typetest.property.valuetypes.models.UnionEnumValueProperty or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "property": "str" # Property. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_value_put_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/azure/generated/typetest-scalar/README.md b/packages/typespec-python/test/azure/generated/typetest-scalar/README.md index bf8ef180fb4..29451029d45 100644 --- a/packages/typespec-python/test/azure/generated/typetest-scalar/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-scalar/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-scalar diff --git a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py index f9551803a63..e0c3527708a 100644 --- a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import decimal import json -from typing import Any, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -43,6 +44,10 @@ build_unknown_put_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +77,7 @@ async def get(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -124,7 +129,7 @@ async def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +195,7 @@ async def get(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,7 +247,7 @@ async def put(self, body: bool, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +313,7 @@ async def get(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +365,7 @@ async def put(self, body: Any, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -426,7 +431,7 @@ async def response_body(self, **kwargs: Any) -> decimal.Decimal: :rtype: ~decimal.Decimal :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +485,7 @@ async def request_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -532,7 +537,7 @@ async def request_parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -594,7 +599,7 @@ async def response_body(self, **kwargs: Any) -> decimal.Decimal: :rtype: ~decimal.Decimal :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +653,7 @@ async def request_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -700,7 +705,7 @@ async def request_parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -770,7 +775,7 @@ async def prepare_verify(self, **kwargs: Any) -> List[decimal.Decimal]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -824,7 +829,7 @@ async def verify( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -898,7 +903,7 @@ async def prepare_verify(self, **kwargs: Any) -> List[decimal.Decimal]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -952,7 +957,7 @@ async def verify( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/operations/_operations.py index c57aa588190..f5caaead110 100644 --- a/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-scalar/typetest/scalar/operations/_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import decimal import json -from typing import Any, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,13 +55,12 @@ def build_string_get_request(**kwargs: Any) -> HttpRequest: def build_string_put_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/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) @@ -78,13 +82,12 @@ def build_boolean_get_request(**kwargs: Any) -> HttpRequest: def build_boolean_put_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/boolean" # 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) @@ -106,13 +109,12 @@ def build_unknown_get_request(**kwargs: Any) -> HttpRequest: def build_unknown_put_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/unknown" # 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) @@ -134,13 +136,12 @@ def build_decimal_type_response_body_request(**kwargs: Any) -> HttpRequest: def build_decimal_type_request_body_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/decimal/resquest_body" # 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) @@ -176,13 +177,12 @@ def build_decimal128_type_response_body_request(**kwargs: Any) -> HttpRequest: def build_decimal128_type_request_body_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/decimal128/resquest_body" # 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) @@ -218,13 +218,12 @@ def build_decimal_verify_prepare_verify_request(**kwargs: Any) -> HttpRequest: def build_decimal_verify_verify_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/decimal/verify" # 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) @@ -246,13 +245,12 @@ def build_decimal128_verify_prepare_verify_request(**kwargs: Any) -> HttpRequest def build_decimal128_verify_verify_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/decimal128/verify" # 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) @@ -282,7 +280,7 @@ def get(self, **kwargs: Any) -> str: :rtype: str :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +332,7 @@ def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,7 +398,7 @@ def get(self, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -452,7 +450,7 @@ def put(self, body: bool, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -518,7 +516,7 @@ def get(self, **kwargs: Any) -> Any: :rtype: any :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -570,7 +568,7 @@ def put(self, body: Any, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +634,7 @@ def response_body(self, **kwargs: Any) -> decimal.Decimal: :rtype: ~decimal.Decimal :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -690,7 +688,7 @@ def request_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -742,7 +740,7 @@ def request_parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -804,7 +802,7 @@ def response_body(self, **kwargs: Any) -> decimal.Decimal: :rtype: ~decimal.Decimal :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -858,7 +856,7 @@ def request_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -910,7 +908,7 @@ def request_parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -980,7 +978,7 @@ def prepare_verify(self, **kwargs: Any) -> List[decimal.Decimal]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1032,7 +1030,7 @@ def verify(self, body: decimal.Decimal, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1104,7 @@ def prepare_verify(self, **kwargs: Any) -> List[decimal.Decimal]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1158,7 +1156,7 @@ def verify(self, body: decimal.Decimal, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-union/README.md b/packages/typespec-python/test/azure/generated/typetest-union/README.md index 136367659fb..7438d06b0f6 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/README.md +++ b/packages/typespec-python/test/azure/generated/typetest-union/README.md @@ -5,7 +5,7 @@ ## Getting started -### Installating the package +### Install the package ```bash python -m pip install typetest-union diff --git a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/aio/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/aio/operations/_operations.py index a66cd0c4ca5..a0f40348138 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/aio/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -78,6 +78,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get(self, **kwargs: Any) -> _models.GetResponse9: + # pylint: disable=line-too-long """get. :return: GetResponse9. The GetResponse9 is compatible with MutableMapping @@ -89,10 +90,11 @@ async def get(self, **kwargs: Any) -> _models.GetResponse9: # response body for status code(s): 200 response == { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -138,6 +140,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse9: async def send( # pylint: disable=inconsistent-return-statements self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """send. :param body: Required. @@ -154,18 +157,20 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ @overload async def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[str, _models.GetResponseProp5], content_type: str = "application/json", **kwargs: Any + self, *, prop: Literal["a", "b", "c"], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: "a", "b", and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp5 + :keyword prop: Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + Required. + :paramtype prop: str or str or str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -192,18 +197,16 @@ async def send( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[str, _models.GetResponseProp5] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: Literal["a", "b", "c"] = _Unset, **kwargs: Any ) -> None: + # pylint: disable=line-too-long """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: "a", "b", and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp5 + :keyword prop: Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + Required. + :paramtype prop: str or str or str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -213,10 +216,11 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -297,10 +301,11 @@ async def get(self, **kwargs: Any) -> _models.GetResponse8: # response body for status code(s): 200 response == { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -362,18 +367,19 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ @overload async def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[str, _models.GetResponseProp4], content_type: str = "application/json", **kwargs: Any + self, *, prop: Union[Literal["b"], Literal["c"], str], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: "b" and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp4 + :keyword prop: Is one of the following types: Literal["b"], Literal["c"], str Required. + :paramtype prop: str or str or str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -403,15 +409,15 @@ async def send( # pylint: disable=inconsistent-return-statements self, body: Union[JSON, IO[bytes]] = _Unset, *, - prop: Union[str, _models.GetResponseProp4] = _Unset, + prop: Union[Literal["b"], Literal["c"], str] = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: "b" and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp4 + :keyword prop: Is one of the following types: Literal["b"], Literal["c"], str Required. + :paramtype prop: str or str or str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -421,10 +427,11 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -508,7 +515,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse7: "prop": "str" # Required. Known values are: "b" and "c". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +643,7 @@ async def send( # pylint: disable=inconsistent-return-statements "prop": "str" # Required. Known values are: "b" and "c". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -717,10 +724,11 @@ async def get(self, **kwargs: Any) -> _models.GetResponse6: # response body for status code(s): 200 response == { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,18 +790,19 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ @overload async def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[int, _models.GetResponseProp3], content_type: str = "application/json", **kwargs: Any + self, *, prop: Literal[1, 2, 3], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: 1, 2, and 3. Required. - :paramtype prop: int or ~typetest.union.models.GetResponseProp3 + :keyword prop: Is one of the following types: Literal[1], Literal[2], Literal[3] Required. + :paramtype prop: int or int or int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -820,18 +829,14 @@ async def send( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[int, _models.GetResponseProp3] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: Literal[1, 2, 3] = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: 1, 2, and 3. Required. - :paramtype prop: int or ~typetest.union.models.GetResponseProp3 + :keyword prop: Is one of the following types: Literal[1], Literal[2], Literal[3] Required. + :paramtype prop: int or int or int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -841,10 +846,11 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -925,10 +931,11 @@ async def get(self, **kwargs: Any) -> _models.GetResponse5: # response body for status code(s): 200 response == { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,18 +997,19 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ @overload async def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[float, _models.GetResponseProp2], content_type: str = "application/json", **kwargs: Any + self, *, prop: float, content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: 1.1, 2.2, and 3.3. Required. - :paramtype prop: float or ~typetest.union.models.GetResponseProp2 + :keyword prop: Is one of the following types: float, float, float Required. + :paramtype prop: float or float or float :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1028,18 +1036,14 @@ async def send( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[float, _models.GetResponseProp2] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: float = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: 1.1, 2.2, and 3.3. Required. - :paramtype prop: float or ~typetest.union.models.GetResponseProp2 + :keyword prop: Is one of the following types: float, float, float Required. + :paramtype prop: float or float or float :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1049,10 +1053,11 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1138,7 +1143,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse4: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1262,7 +1267,7 @@ async def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1345,14 +1350,16 @@ async def get(self, **kwargs: Any) -> _models.GetResponse3: # response body for status code(s): 200 response == { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1416,10 +1423,12 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ @@ -1477,14 +1486,16 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1574,7 +1585,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse2: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1706,7 +1717,7 @@ async def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1804,7 +1815,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse1: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1952,7 +1963,7 @@ async def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2049,7 +2060,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2195,7 +2206,7 @@ async def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/__init__.py b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/__init__.py index 93053b222fd..4ec15a113cd 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/__init__.py +++ b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/__init__.py @@ -23,12 +23,6 @@ from ._models import MixedTypesCases from ._models import StringAndArrayCases -from ._enums import EnumsOnlyCasesLr -from ._enums import EnumsOnlyCasesUd -from ._enums import GetResponseProp2 -from ._enums import GetResponseProp3 -from ._enums import GetResponseProp4 -from ._enums import GetResponseProp5 from ._enums import StringExtensibleNamedUnion from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -51,12 +45,6 @@ "MixedLiteralsCases", "MixedTypesCases", "StringAndArrayCases", - "EnumsOnlyCasesLr", - "EnumsOnlyCasesUd", - "GetResponseProp2", - "GetResponseProp3", - "GetResponseProp4", - "GetResponseProp5", "StringExtensibleNamedUnion", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/_enums.py b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/_enums.py index 60c23aefb67..8057e6b79bd 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/_enums.py +++ b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/_enums.py @@ -10,53 +10,6 @@ from azure.core import CaseInsensitiveEnumMeta -class EnumsOnlyCasesLr(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of EnumsOnlyCasesLr.""" - - LEFT = "left" - RIGHT = "right" - UP = "up" - DOWN = "down" - - -class EnumsOnlyCasesUd(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of EnumsOnlyCasesUd.""" - - UP = "up" - DOWN = "down" - - -class GetResponseProp2(float, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of GetResponseProp2.""" - - ENUM_1_1 = 1.1 - ENUM_2_2 = 2.2 - ENUM_3_3 = 3.3 - - -class GetResponseProp3(int, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of GetResponseProp3.""" - - ENUM_1 = 1 - ENUM_2 = 2 - ENUM_3 = 3 - - -class GetResponseProp4(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of GetResponseProp4.""" - - B = "b" - C = "c" - - -class GetResponseProp5(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of GetResponseProp5.""" - - A = "a" - B = "b" - C = "c" - - class StringExtensibleNamedUnion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of StringExtensibleNamedUnion.""" diff --git a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/_models.py b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/_models.py index aaeb45907fe..c19f7ab9ade 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/_models.py +++ b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/models/_models.py @@ -91,26 +91,27 @@ class EnumsOnlyCases(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar lr: This should be receive/send the left variant. Required. Known values are: "left", - "right", "up", and "down". - :vartype lr: str or ~typetest.union.models.EnumsOnlyCasesLr - :ivar ud: This should be receive/send the up variant. Required. Known values are: "up" and - "down". - :vartype ud: str or ~typetest.union.models.EnumsOnlyCasesUd + :ivar lr: This should be receive/send the left variant. Required. Is one of the following + types: Literal["left"], Literal["right"], Literal["up"], Literal["down"] + :vartype lr: str or str or str or str + :ivar ud: This should be receive/send the up variant. Required. Is either a Literal["up"] type + or a Literal["down"] type. + :vartype ud: str or str """ - lr: Union[str, "_models.EnumsOnlyCasesLr"] = rest_field() - """This should be receive/send the left variant. Required. Known values are: \"left\", \"right\", - \"up\", and \"down\".""" - ud: Union[str, "_models.EnumsOnlyCasesUd"] = rest_field() - """This should be receive/send the up variant. Required. Known values are: \"up\" and \"down\".""" + lr: Literal["left", "right", "up", "down"] = rest_field() + """This should be receive/send the left variant. Required. Is one of the following types: + Literal[\"left\"], Literal[\"right\"], Literal[\"up\"], Literal[\"down\"]""" + ud: Literal["up", "down"] = rest_field() + """This should be receive/send the up variant. Required. Is either a Literal[\"up\"] type or a + Literal[\"down\"] type.""" @overload def __init__( self, *, - lr: Union[str, "_models.EnumsOnlyCasesLr"], - ud: Union[str, "_models.EnumsOnlyCasesUd"], + lr: Literal["left", "right", "up", "down"], + ud: Literal["up", "down"], ): ... @@ -285,18 +286,18 @@ class GetResponse5(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar prop: Required. Known values are: 1.1, 2.2, and 3.3. - :vartype prop: float or ~typetest.union.models.GetResponseProp2 + :ivar prop: Required. Is one of the following types: float, float, float + :vartype prop: float or float or float """ - prop: Union[float, "_models.GetResponseProp2"] = rest_field() - """Required. Known values are: 1.1, 2.2, and 3.3.""" + prop: float = rest_field() + """Required. Is one of the following types: float, float, float""" @overload def __init__( self, *, - prop: Union[float, "_models.GetResponseProp2"], + prop: float, ): ... @@ -316,18 +317,18 @@ class GetResponse6(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar prop: Required. Known values are: 1, 2, and 3. - :vartype prop: int or ~typetest.union.models.GetResponseProp3 + :ivar prop: Required. Is one of the following types: Literal[1], Literal[2], Literal[3] + :vartype prop: int or int or int """ - prop: Union[int, "_models.GetResponseProp3"] = rest_field() - """Required. Known values are: 1, 2, and 3.""" + prop: Literal[1, 2, 3] = rest_field() + """Required. Is one of the following types: Literal[1], Literal[2], Literal[3]""" @overload def __init__( self, *, - prop: Union[int, "_models.GetResponseProp3"], + prop: Literal[1, 2, 3], ): ... @@ -378,18 +379,18 @@ class GetResponse8(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar prop: Required. Known values are: "b" and "c". - :vartype prop: str or ~typetest.union.models.GetResponseProp4 + :ivar prop: Required. Is one of the following types: Literal["b"], Literal["c"], str + :vartype prop: str or str or str """ - prop: Union[str, "_models.GetResponseProp4"] = rest_field() - """Required. Known values are: \"b\" and \"c\".""" + prop: Union[Literal["b"], Literal["c"], str] = rest_field() + """Required. Is one of the following types: Literal[\"b\"], Literal[\"c\"], str""" @overload def __init__( self, *, - prop: Union[str, "_models.GetResponseProp4"], + prop: Union[Literal["b"], Literal["c"], str], ): ... @@ -409,18 +410,18 @@ class GetResponse9(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar prop: Required. Known values are: "a", "b", and "c". - :vartype prop: str or ~typetest.union.models.GetResponseProp5 + :ivar prop: Required. Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + :vartype prop: str or str or str """ - prop: Union[str, "_models.GetResponseProp5"] = rest_field() - """Required. Known values are: \"a\", \"b\", and \"c\".""" + prop: Literal["a", "b", "c"] = rest_field() + """Required. Is one of the following types: Literal[\"a\"], Literal[\"b\"], Literal[\"c\"]""" @overload def __init__( self, *, - prop: Union[str, "_models.GetResponseProp5"], + prop: Literal["a", "b", "c"], ): ... diff --git a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/operations/_operations.py b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/operations/_operations.py index e44eccc44ed..1ae224fe371 100644 --- a/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/operations/_operations.py +++ b/packages/typespec-python/test/azure/generated/typetest-union/typetest/union/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -340,6 +340,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def get(self, **kwargs: Any) -> _models.GetResponse9: + # pylint: disable=line-too-long """get. :return: GetResponse9. The GetResponse9 is compatible with MutableMapping @@ -351,10 +352,11 @@ def get(self, **kwargs: Any) -> _models.GetResponse9: # response body for status code(s): 200 response == { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,6 +402,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse9: def send( # pylint: disable=inconsistent-return-statements self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """send. :param body: Required. @@ -416,18 +419,20 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ @overload def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[str, _models.GetResponseProp5], content_type: str = "application/json", **kwargs: Any + self, *, prop: Literal["a", "b", "c"], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: "a", "b", and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp5 + :keyword prop: Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + Required. + :paramtype prop: str or str or str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -454,18 +459,16 @@ def send( # pylint: disable=inconsistent-return-statements @distributed_trace def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[str, _models.GetResponseProp5] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: Literal["a", "b", "c"] = _Unset, **kwargs: Any ) -> None: + # pylint: disable=line-too-long """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: "a", "b", and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp5 + :keyword prop: Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + Required. + :paramtype prop: str or str or str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -475,10 +478,11 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -559,10 +563,11 @@ def get(self, **kwargs: Any) -> _models.GetResponse8: # response body for status code(s): 200 response == { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -624,18 +629,19 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ @overload def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[str, _models.GetResponseProp4], content_type: str = "application/json", **kwargs: Any + self, *, prop: Union[Literal["b"], Literal["c"], str], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: "b" and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp4 + :keyword prop: Is one of the following types: Literal["b"], Literal["c"], str Required. + :paramtype prop: str or str or str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -665,15 +671,15 @@ def send( # pylint: disable=inconsistent-return-statements self, body: Union[JSON, IO[bytes]] = _Unset, *, - prop: Union[str, _models.GetResponseProp4] = _Unset, + prop: Union[Literal["b"], Literal["c"], str] = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: "b" and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp4 + :keyword prop: Is one of the following types: Literal["b"], Literal["c"], str Required. + :paramtype prop: str or str or str :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -683,10 +689,11 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -770,7 +777,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse7: "prop": "str" # Required. Known values are: "b" and "c". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -898,7 +905,7 @@ def send( # pylint: disable=inconsistent-return-statements "prop": "str" # Required. Known values are: "b" and "c". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -979,10 +986,11 @@ def get(self, **kwargs: Any) -> _models.GetResponse6: # response body for status code(s): 200 response == { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1044,18 +1052,19 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ @overload def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[int, _models.GetResponseProp3], content_type: str = "application/json", **kwargs: Any + self, *, prop: Literal[1, 2, 3], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: 1, 2, and 3. Required. - :paramtype prop: int or ~typetest.union.models.GetResponseProp3 + :keyword prop: Is one of the following types: Literal[1], Literal[2], Literal[3] Required. + :paramtype prop: int or int or int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1082,18 +1091,14 @@ def send( # pylint: disable=inconsistent-return-statements @distributed_trace def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[int, _models.GetResponseProp3] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: Literal[1, 2, 3] = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: 1, 2, and 3. Required. - :paramtype prop: int or ~typetest.union.models.GetResponseProp3 + :keyword prop: Is one of the following types: Literal[1], Literal[2], Literal[3] Required. + :paramtype prop: int or int or int :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1103,10 +1108,11 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1187,10 +1193,11 @@ def get(self, **kwargs: Any) -> _models.GetResponse5: # response body for status code(s): 200 response == { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1252,18 +1259,19 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ @overload def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[float, _models.GetResponseProp2], content_type: str = "application/json", **kwargs: Any + self, *, prop: float, content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: 1.1, 2.2, and 3.3. Required. - :paramtype prop: float or ~typetest.union.models.GetResponseProp2 + :keyword prop: Is one of the following types: float, float, float Required. + :paramtype prop: float or float or float :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1290,18 +1298,14 @@ def send( # pylint: disable=inconsistent-return-statements @distributed_trace def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[float, _models.GetResponseProp2] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: float = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: 1.1, 2.2, and 3.3. Required. - :paramtype prop: float or ~typetest.union.models.GetResponseProp2 + :keyword prop: Is one of the following types: float, float, float Required. + :paramtype prop: float or float or float :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1311,10 +1315,11 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1400,7 +1405,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse4: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1524,7 +1529,7 @@ def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1607,14 +1612,16 @@ def get(self, **kwargs: Any) -> _models.GetResponse3: # response body for status code(s): 200 response == { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1678,10 +1685,12 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ @@ -1739,14 +1748,16 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1836,7 +1847,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse2: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1968,7 +1979,7 @@ def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2066,7 +2077,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse1: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2214,7 +2225,7 @@ def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2311,7 +2322,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2457,7 +2468,7 @@ def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py b/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py new file mode 100644 index 00000000000..ab6e195d41d --- /dev/null +++ b/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py @@ -0,0 +1,38 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +from specs.azure.core.scalar.aio import ScalarClient +from specs.azure.core.scalar import models + + +@pytest.fixture +async def client(): + async with ScalarClient() as client: + yield client + + +async def test_azure_location_scalar_get(client: ScalarClient): + result = await client.azure_location_scalar.get() + assert result == "eastus" + + +async def test_azure_location_scalar_put(client: ScalarClient): + await client.azure_location_scalar.put("eastus") + + +async def test_azure_location_scalar_post(client: ScalarClient): + result = await client.azure_location_scalar.post( + models.AzureLocationModel(location="eastus") + ) + assert result == models.AzureLocationModel(location="eastus") + + +async def test_azure_location_scalar_header(client: ScalarClient): + await client.azure_location_scalar.header(region="eastus") + + +async def test_azure_location_scalar_query(client: ScalarClient): + await client.azure_location_scalar.query(region="eastus") diff --git a/packages/typespec-python/test/azure/mock_api_tests/test_azure_core_scalar.py b/packages/typespec-python/test/azure/mock_api_tests/test_azure_core_scalar.py new file mode 100644 index 00000000000..7f997c21fb8 --- /dev/null +++ b/packages/typespec-python/test/azure/mock_api_tests/test_azure_core_scalar.py @@ -0,0 +1,37 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +from specs.azure.core.scalar import ScalarClient, models + + +@pytest.fixture +def client(): + with ScalarClient() as client: + yield client + + +def test_azure_location_scalar_get(client: ScalarClient): + result = client.azure_location_scalar.get() + assert result == "eastus" + + +def test_azure_location_scalar_put(client: ScalarClient): + client.azure_location_scalar.put("eastus") + + +def test_azure_location_scalar_post(client: ScalarClient): + result = client.azure_location_scalar.post( + models.AzureLocationModel(location="eastus") + ) + assert result == models.AzureLocationModel(location="eastus") + + +def test_azure_location_scalar_header(client: ScalarClient): + client.azure_location_scalar.header(region="eastus") + + +def test_azure_location_scalar_query(client: ScalarClient): + client.azure_location_scalar.query(region="eastus") diff --git a/packages/typespec-python/test/azure/requirements.txt b/packages/typespec-python/test/azure/requirements.txt index 354e684e6ea..66e732bad7b 100644 --- a/packages/typespec-python/test/azure/requirements.txt +++ b/packages/typespec-python/test/azure/requirements.txt @@ -9,6 +9,7 @@ azure-core==1.30.0 -e ./generated/azure-client-generator-core-usage -e ./generated/azure-client-generator-core-flatten -e ./generated/azure-core-basic +-e ./generated/azure-core-scalar -e ./generated/azurecore-lro-rpclegacy -e ./generated/azurecore-lro-rpc -e ./generated/azure-core-lro-standard @@ -24,10 +25,10 @@ azure-core==1.30.0 -e ./generated/encode-duration -e ./generated/parameters-collection-format -e ./generated/parameters-spread --e ./generated/projection-projected-name -e ./generated/resiliency-srv-driven1 -e ./generated/resiliency-srv-driven2 -e ./generated/serialization-encoded-name-json +-e ./generated/server-endpoint-not-defined -e ./generated/server-path-multiple -e ./generated/server-path-single -e ./generated/server-versions-versioned diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_client_naming_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_client_naming_async.py index b82d9615294..c20f431c405 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_client_naming_async.py +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_client_naming_async.py @@ -59,3 +59,13 @@ async def test_model_client(client: NamingClient): @pytest.mark.asyncio async def test_model_language(client: NamingClient): await client.model.language(models.PythonModel(default_name=True)) + + +@pytest.mark.asyncio +async def test_union_enum_member_name(client: NamingClient): + await client.union_enum.union_enum_member_name(models.ExtensibleEnum.CLIENT_ENUM_VALUE1) + + +@pytest.mark.asyncio +async def test_union_enum_member_name(client: NamingClient): + await client.union_enum.union_enum_name(models.ClientExtensibleEnum.ENUM_VALUE1) diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_projection_projected_name_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_projection_projected_name_async.py deleted file mode 100644 index 0aff32f144b..00000000000 --- a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_projection_projected_name_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest -from projection.projectedname import aio, models - -@pytest.fixture -async def client(): - async with aio.ProjectedNameClient() as client: - yield client - -@pytest.mark.asyncio -async def test_property_json(client: aio.ProjectedNameClient): - await client.property.json(models.JsonAndClientProjectedNameModel(client_name=True)) - -@pytest.mark.asyncio -async def test_property_client(client: aio.ProjectedNameClient): - await client.property.client(models.ClientProjectedNameModel(client_name=True)) - -@pytest.mark.asyncio -async def test_property_language(client: aio.ProjectedNameClient): - await client.property.language(models.LanguageProjectedNameModel(python_name=True)) - -@pytest.mark.asyncio -async def test_property_json_and_client(client: aio.ProjectedNameClient): - await client.property.json_and_client(models.JsonAndClientProjectedNameModel(client_name=True)) - -@pytest.mark.asyncio -async def test_operation(client: aio.ProjectedNameClient): - # test that projected client name for operation is client_name - await client.client_name() - -@pytest.mark.asyncio -async def test_parameter(client: aio.ProjectedNameClient): - await client.parameter(client_name="true") - - -@pytest.mark.asyncio -async def test_model_client(client: aio.ProjectedNameClient): - await client.model.client(models.ClientModel(default_name=True)) - -@pytest.mark.asyncio -async def test_model_language(client: aio.ProjectedNameClient): - await client.model.language(models.PythonModel(default_name=True)) diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py new file mode 100644 index 00000000000..148e61dd5ca --- /dev/null +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py @@ -0,0 +1,18 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +from server.endpoint.notdefined.aio import NotDefinedClient + + +@pytest.fixture +async def client(): + async with NotDefinedClient(endpoint="http://localhost:3000") as client: + yield client + + +@pytest.mark.asyncio +async def test_valid(client: NotDefinedClient): + assert await client.valid() is True diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py index a34d1194a76..d097487d085 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py @@ -31,7 +31,7 @@ async def client(): "k1": models.InnerModel(property="hello", children={}), "k2": models.InnerModel(property="world", children={"k2.1": models.InnerModel(property="inner world")}), }), - ("nullable_float_value", {"k1": 1.2, "k2": 0.5, "k3": None}), + ("nullable_float_value", {"k1": 1.25, "k2": 0.5, "k3": None}), ] ) @pytest.mark.asyncio diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py index 49e630651f5..60df0b042f6 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py @@ -22,11 +22,11 @@ async def client(): ("collections_model", [{'property': 'hello'}, {'property': 'world'}]), ("string_literal", "hello"), ("int_literal", 1), - ("float_literal", 1.2), + ("float_literal", 1.25), ("boolean_literal", True), ("union_string_literal", "world"), ("union_int_literal", 2), - ("union_float_literal", 2.3), + ("union_float_literal", 2.375), ] ) @pytest.mark.asyncio @@ -48,11 +48,11 @@ async def test_json(client, og_name, val): ("collections_model", models.CollectionsModelProperty, [models.StringProperty(property="hello"), models.StringProperty(property="world")]), ("string_literal", models.StringLiteralProperty, "hello"), ("int_literal", models.IntLiteralProperty, 1), - ("float_literal", models.FloatLiteralProperty, 1.2), + ("float_literal", models.FloatLiteralProperty, 1.25), ("boolean_literal", models.BooleanLiteralProperty, True), ("union_string_literal", models.UnionStringLiteralProperty, "world"), ("union_int_literal", models.UnionIntLiteralProperty, 2), - ("union_float_literal", models.UnionFloatLiteralProperty, 2.3), + ("union_float_literal", models.UnionFloatLiteralProperty, 2.375), ] ) @pytest.mark.asyncio diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py index 0798a1dd41d..16953703cc6 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py @@ -19,7 +19,8 @@ async def client(): @pytest.mark.asyncio @pytest.mark.parametrize( - "og_name,val", [ + "og_name,val", + [ ("boolean", True), ("string", "hello"), ("bytes", "aGVsbG8sIHdvcmxkIQ=="), @@ -31,15 +32,15 @@ async def client(): ("duration", "P123DT22H14M12.011S"), ("enum", "ValueOne"), ("extensible_enum", "UnknownValue"), - ("model", {'property': 'hello'}), - ("collections_string", ['hello', 'world']), + ("model", {"property": "hello"}), + ("collections_string", ["hello", "world"]), ("collections_int", [1, 2]), - ("collections_model", [{'property': 'hello'}, {'property': 'world'}]), - ("dictionary_string", {'k1': 'hello', 'k2': 'world'}), + ("collections_model", [{"property": "hello"}, {"property": "world"}]), + ("dictionary_string", {"k1": "hello", "k2": "world"}), ("unknown_string", "hello"), ("unknown_int", 42), - ("unknown_dict", {'k1': 'hello', 'k2': 42}), - ("unknown_array", ['hello', 'world']), + ("unknown_dict", {"k1": "hello", "k2": 42}), + ("unknown_array", ["hello", "world"]), ("boolean_literal", True), ("int_literal", 42), ("string_literal", "hello"), @@ -47,7 +48,8 @@ async def client(): ("union_string_literal", "world"), ("union_float_literal", 46.875), ("union_int_literal", 42), - ] + ("union_enum_value", "value2"), + ], ) async def test(client, og_name, val): body = {"property": val} @@ -57,10 +59,11 @@ async def test(client, og_name, val): @pytest.mark.parametrize( - "og_name,model,val", [ + "og_name,model,val", + [ ("boolean", models.BooleanProperty, True), ("string", models.StringProperty, "hello"), - ("bytes", models.BytesProperty, b'hello, world!'), + ("bytes", models.BytesProperty, b"hello, world!"), ("int_operations", models.IntProperty, 42), ("float", models.FloatProperty, 43.125), ("decimal", models.DecimalProperty, decimal.Decimal("0.33333")), @@ -68,17 +71,22 @@ async def test(client, og_name, val): ("enum", models.EnumProperty, models.InnerEnum.VALUE_ONE), ("extensible_enum", models.ExtensibleEnumProperty, "UnknownValue"), ("model", models.ModelProperty, models.InnerModel(property="hello")), - ("collections_string", - models.CollectionsStringProperty, ['hello', 'world']), + ("collections_string", models.CollectionsStringProperty, ["hello", "world"]), ("collections_int", models.CollectionsIntProperty, [1, 2]), - ("collections_model", models.CollectionsModelProperty, - [{'property': 'hello'}, {'property': 'world'}]), - ("dictionary_string", models.DictionaryStringProperty, - {'k1': 'hello', 'k2': 'world'}), + ( + "collections_model", + models.CollectionsModelProperty, + [{"property": "hello"}, {"property": "world"}], + ), + ( + "dictionary_string", + models.DictionaryStringProperty, + {"k1": "hello", "k2": "world"}, + ), ("unknown_string", models.UnknownStringProperty, "hello"), ("unknown_int", models.UnknownIntProperty, 42), - ("unknown_dict", models.UnknownDictProperty, {'k1': 'hello', 'k2': 42}), - ("unknown_array", models.UnknownArrayProperty, ['hello', 'world']), + ("unknown_dict", models.UnknownDictProperty, {"k1": "hello", "k2": 42}), + ("unknown_array", models.UnknownArrayProperty, ["hello", "world"]), ("boolean_literal", models.BooleanLiteralProperty, True), ("int_literal", models.IntLiteralProperty, 42), ("string_literal", models.StringLiteralProperty, "hello"), @@ -86,7 +94,12 @@ async def test(client, og_name, val): ("union_string_literal", models.UnionStringLiteralProperty, "world"), ("union_float_literal", models.UnionFloatLiteralProperty, 46.875), ("union_int_literal", models.UnionIntLiteralProperty, 42), - ] + ( + "union_enum_value", + models.UnionEnumValueProperty, + models.ExtendedEnum.ENUM_VALUE2, + ), + ], ) @pytest.mark.asyncio async def test_model(client, og_name, model, val): @@ -100,13 +113,17 @@ async def test_model(client, og_name, model, val): @pytest.mark.asyncio async def test_datetime_model(client): received_body = await client.datetime.get() - assert received_body == {"property": '2022-08-26T18:38:00Z'} + assert received_body == {"property": "2022-08-26T18:38:00Z"} assert received_body.property.year == 2022 assert received_body.property.month == 8 assert received_body.property.day == 26 assert received_body.property.hour == 18 assert received_body.property.minute == 38 - await client.datetime.put(models.DatetimeProperty(property=datetime.datetime(2022, 8, 26, hour=18, minute=38))) + await client.datetime.put( + models.DatetimeProperty( + property=datetime.datetime(2022, 8, 26, hour=18, minute=38) + ) + ) @pytest.mark.asyncio @@ -114,6 +131,7 @@ async def test_never_model(client: ValueTypesClient): assert await client.never.get() == models.NeverProperty() await client.never.put(models.NeverProperty()) + @pytest.mark.asyncio async def test_model_deserialization(client: ValueTypesClient): body = models.ModelProperty(property={"property": "hello"}) @@ -121,7 +139,9 @@ async def test_model_deserialization(client: ValueTypesClient): resp = await client.model.get() assert resp.property.property == resp["property"]["property"] - body = models.CollectionsModelProperty(property=[{'property': 'hello'}, {'property': 'world'}]) + body = models.CollectionsModelProperty( + property=[{"property": "hello"}, {"property": "world"}] + ) assert body.property[0].property == body["property"][0]["property"] resp = await client.collections_model.get() assert resp.property[1].property == resp["property"][1]["property"] diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py index a299c8188e2..70afde8575b 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py @@ -24,7 +24,7 @@ async def client(): ("models_only", models.Cat(name="test"), models.GetResponse5), ( "enums_only", - models.EnumsOnlyCases(lr=models.EnumsOnlyCasesLr.RIGHT, ud=models.EnumsOnlyCasesLr.UP), + models.EnumsOnlyCases(lr="right", ud="up"), models.GetResponse6, ), ( diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_client_naming.py b/packages/typespec-python/test/generic_mock_api_tests/test_client_naming.py index 1a2d8d919b0..3914ba0e4f4 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/test_client_naming.py +++ b/packages/typespec-python/test/generic_mock_api_tests/test_client_naming.py @@ -49,3 +49,11 @@ def test_model_client(client: NamingClient): def test_model_language(client: NamingClient): client.model.language(models.PythonModel(default_name=True)) + + +def test_union_enum_member_name(client: NamingClient): + client.union_enum.union_enum_member_name(models.ExtensibleEnum.CLIENT_ENUM_VALUE1) + + +def test_union_enum_member_name(client: NamingClient): + client.union_enum.union_enum_name(models.ClientExtensibleEnum.ENUM_VALUE1) diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_projection_projected_name.py b/packages/typespec-python/test/generic_mock_api_tests/test_projection_projected_name.py deleted file mode 100644 index 5e7cd5539b3..00000000000 --- a/packages/typespec-python/test/generic_mock_api_tests/test_projection_projected_name.py +++ /dev/null @@ -1,37 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import pytest -from projection.projectedname import ProjectedNameClient, models - -@pytest.fixture -def client(): - with ProjectedNameClient() as client: - yield client - -def test_property_json(client: ProjectedNameClient): - client.property.json(models.JsonAndClientProjectedNameModel(client_name=True)) - -def test_property_client(client: ProjectedNameClient): - client.property.client(models.ClientProjectedNameModel(client_name=True)) - -def test_property_language(client: ProjectedNameClient): - client.property.language(models.LanguageProjectedNameModel(python_name=True)) - -def test_property_json_and_client(client: ProjectedNameClient): - client.property.json_and_client(models.JsonAndClientProjectedNameModel(client_name=True)) - -def test_operation(client: ProjectedNameClient): - # test that projected client name for operation is client_name - client.client_name() - -def test_parameter(client: ProjectedNameClient): - client.parameter(client_name="true") - -def test_model_client(client: ProjectedNameClient): - client.model.client(models.ClientModel(default_name=True)) - -def test_model_language(client: ProjectedNameClient): - client.model.language(models.PythonModel(default_name=True)) diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_server_endpoint_not_defined.py b/packages/typespec-python/test/generic_mock_api_tests/test_server_endpoint_not_defined.py new file mode 100644 index 00000000000..432542dd958 --- /dev/null +++ b/packages/typespec-python/test/generic_mock_api_tests/test_server_endpoint_not_defined.py @@ -0,0 +1,17 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +from server.endpoint.notdefined import NotDefinedClient + + +@pytest.fixture +def client(): + with NotDefinedClient(endpoint="http://localhost:3000") as client: + yield client + + +def test_valid(client: NotDefinedClient): + assert client.valid() is True diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_array.py b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_array.py index 0160210905a..8bcd0cf7693 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_array.py +++ b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_array.py @@ -33,7 +33,7 @@ def client(): models.InnerModel(property="world"), ], ), - ("nullable_float_value", [1.2, None, 3.0]), + ("nullable_float_value", [1.25, None, 3.0]), ], ) def test_array(client: ArrayClient, og_name: str, val: dict): diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_dictionary.py b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_dictionary.py index 65f1f5f9dc6..9b75aaac888 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_dictionary.py +++ b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_dictionary.py @@ -29,7 +29,7 @@ def client(): "k1": models.InnerModel(property="hello", children={}), "k2": models.InnerModel(property="world", children={"k2.1": models.InnerModel(property="inner world")}), }), - ("nullable_float_value", {"k1": 1.2, "k2": 0.5, "k3": None}), + ("nullable_float_value", {"k1": 1.25, "k2": 0.5, "k3": None}), ] ) def test_dictionary(client: DictionaryClient, og_name: str, val: dict): diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_property_optional.py b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_property_optional.py index ee7e8eb2663..aba0f364636 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_property_optional.py +++ b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_property_optional.py @@ -22,11 +22,11 @@ def client(): ("collections_model", [{'property': 'hello'}, {'property': 'world'}]), ("string_literal", "hello"), ("int_literal", 1), - ("float_literal", 1.2), + ("float_literal", 1.25), ("boolean_literal", True), ("union_string_literal", "world"), ("union_int_literal", 2), - ("union_float_literal", 2.3), + ("union_float_literal", 2.375), ] ) def test_json(client, og_name, val): @@ -47,11 +47,11 @@ def test_json(client, og_name, val): ("collections_model", models.CollectionsModelProperty, [models.StringProperty(property="hello"), models.StringProperty(property="world")]), ("string_literal", models.StringLiteralProperty, "hello"), ("int_literal", models.IntLiteralProperty, 1), - ("float_literal", models.FloatLiteralProperty, 1.2), + ("float_literal", models.FloatLiteralProperty, 1.25), ("boolean_literal", models.BooleanLiteralProperty, True), ("union_string_literal", models.UnionStringLiteralProperty, "world"), ("union_int_literal", models.UnionIntLiteralProperty, 2), - ("union_float_literal", models.UnionFloatLiteralProperty, 2.3), + ("union_float_literal", models.UnionFloatLiteralProperty, 2.375), ] ) def test_model(client, og_name, model, val): diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_property_valuetypes.py b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_property_valuetypes.py index 4480e1f2ff8..35ca4844552 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +++ b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_property_valuetypes.py @@ -17,7 +17,8 @@ def client(): @pytest.mark.parametrize( - "og_name,val", [ + "og_name,val", + [ ("boolean", True), ("string", "hello"), ("bytes", "aGVsbG8sIHdvcmxkIQ=="), @@ -25,19 +26,19 @@ def client(): ("float", 43.125), ("decimal", decimal.Decimal("0.33333")), ("decimal128", decimal.Decimal("0.33333")), - ("datetime", '2022-08-26T18:38:00Z'), + ("datetime", "2022-08-26T18:38:00Z"), ("duration", "P123DT22H14M12.011S"), ("enum", "ValueOne"), ("extensible_enum", "UnknownValue"), - ("model", {'property': 'hello'}), - ("collections_string", ['hello', 'world']), + ("model", {"property": "hello"}), + ("collections_string", ["hello", "world"]), ("collections_int", [1, 2]), - ("collections_model", [{'property': 'hello'}, {'property': 'world'}]), - ("dictionary_string", {'k1': 'hello', 'k2': 'world'}), + ("collections_model", [{"property": "hello"}, {"property": "world"}]), + ("dictionary_string", {"k1": "hello", "k2": "world"}), ("unknown_string", "hello"), ("unknown_int", 42), - ("unknown_dict", {'k1': 'hello', 'k2': 42}), - ("unknown_array", ['hello', 'world']), + ("unknown_dict", {"k1": "hello", "k2": 42}), + ("unknown_array", ["hello", "world"]), ("boolean_literal", True), ("int_literal", 42), ("string_literal", "hello"), @@ -45,7 +46,8 @@ def client(): ("union_string_literal", "world"), ("union_float_literal", 46.875), ("union_int_literal", 42), - ] + ("union_enum_value", "value2"), + ], ) def test_json(client, og_name, val): body = {"property": val} @@ -55,10 +57,11 @@ def test_json(client, og_name, val): @pytest.mark.parametrize( - "og_name,model,val", [ + "og_name,model,val", + [ ("boolean", models.BooleanProperty, True), ("string", models.StringProperty, "hello"), - ("bytes", models.BytesProperty, b'hello, world!'), + ("bytes", models.BytesProperty, b"hello, world!"), ("int_operations", models.IntProperty, 42), ("float", models.FloatProperty, 43.125), ("decimal", models.DecimalProperty, decimal.Decimal("0.33333")), @@ -66,17 +69,22 @@ def test_json(client, og_name, val): ("enum", models.EnumProperty, models.InnerEnum.VALUE_ONE), ("extensible_enum", models.ExtensibleEnumProperty, "UnknownValue"), ("model", models.ModelProperty, models.InnerModel(property="hello")), - ("collections_string", - models.CollectionsStringProperty, ['hello', 'world']), + ("collections_string", models.CollectionsStringProperty, ["hello", "world"]), ("collections_int", models.CollectionsIntProperty, [1, 2]), - ("collections_model", models.CollectionsModelProperty, - [{'property': 'hello'}, {'property': 'world'}]), - ("dictionary_string", models.DictionaryStringProperty, - {'k1': 'hello', 'k2': 'world'}), + ( + "collections_model", + models.CollectionsModelProperty, + [{"property": "hello"}, {"property": "world"}], + ), + ( + "dictionary_string", + models.DictionaryStringProperty, + {"k1": "hello", "k2": "world"}, + ), ("unknown_string", models.UnknownStringProperty, "hello"), ("unknown_int", models.UnknownIntProperty, 42), - ("unknown_dict", models.UnknownDictProperty, {'k1': 'hello', 'k2': 42}), - ("unknown_array", models.UnknownArrayProperty, ['hello', 'world']), + ("unknown_dict", models.UnknownDictProperty, {"k1": "hello", "k2": 42}), + ("unknown_array", models.UnknownArrayProperty, ["hello", "world"]), ("boolean_literal", models.BooleanLiteralProperty, True), ("int_literal", models.IntLiteralProperty, 42), ("string_literal", models.StringLiteralProperty, "hello"), @@ -84,7 +92,8 @@ def test_json(client, og_name, val): ("union_string_literal", models.UnionStringLiteralProperty, "world"), ("union_float_literal", models.UnionFloatLiteralProperty, 46.875), ("union_int_literal", models.UnionIntLiteralProperty, 42), - ] + ("union_enum_value", models.UnionEnumValueProperty, models.ExtendedEnum.ENUM_VALUE2), + ], ) def test_model(client, og_name, model, val): body = model(property=val) @@ -96,14 +105,17 @@ def test_model(client, og_name, model, val): def test_datetime_model(client): received_body = client.datetime.get() - assert received_body == {"property": '2022-08-26T18:38:00Z'} + assert received_body == {"property": "2022-08-26T18:38:00Z"} assert received_body.property.year == 2022 assert received_body.property.month == 8 assert received_body.property.day == 26 assert received_body.property.hour == 18 assert received_body.property.minute == 38 - client.datetime.put(models.DatetimeProperty( - property=datetime.datetime(2022, 8, 26, hour=18, minute=38))) + client.datetime.put( + models.DatetimeProperty( + property=datetime.datetime(2022, 8, 26, hour=18, minute=38) + ) + ) def test_never_model(client: ValueTypesClient): @@ -117,7 +129,9 @@ def test_model_deserialization(client: ValueTypesClient): resp = client.model.get() assert resp.property.property == resp["property"]["property"] - body = models.CollectionsModelProperty(property=[{'property': 'hello'}, {'property': 'world'}]) + body = models.CollectionsModelProperty( + property=[{"property": "hello"}, {"property": "world"}] + ) assert body.property[0].property == body["property"][0]["property"] resp = client.collections_model.get() assert resp.property[1].property == resp["property"][1]["property"] diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_union.py b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_union.py index 42ae10917cf..a4ec8262dc0 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/test_typetest_union.py +++ b/packages/typespec-python/test/generic_mock_api_tests/test_typetest_union.py @@ -26,7 +26,7 @@ def client(): ("models_only", models.Cat(name="test"), models.GetResponse5), ( "enums_only", - models.EnumsOnlyCases(lr=models.EnumsOnlyCasesLr.RIGHT, ud=models.EnumsOnlyCasesLr.UP), + models.EnumsOnlyCases(lr="right", ud="up"), models.GetResponse6, ), ( diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_client.py b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_client.py index 0cd650a33d0..f8e903e552f 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_client.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_client.py @@ -21,7 +21,7 @@ class ApiKeyClient(ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_configuration.py b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_configuration.py index ddd59ab3c1b..78c340d7716 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_configuration.py @@ -20,7 +20,7 @@ class ApiKeyClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential """ diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_operations/_operations.py index 163d65f0934..4f3afbe0e25 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from corehttp.exceptions import ( ClientAuthenticationError, @@ -18,10 +19,17 @@ ) from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime.pipeline import PipelineResponse +from corehttp.utils import case_insensitive_dict +from .. import models as _models +from .._model_base import _deserialize from .._serialization import Serializer from .._vendor import ApiKeyClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,10 +45,17 @@ def build_api_key_valid_request(**kwargs: Any) -> HttpRequest: def build_api_key_invalid_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/authentication/api-key/invalid" - return HttpRequest(method="GET", url=_url, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) class ApiKeyClientOperationsMixin(ApiKeyClientMixinABC): @@ -51,7 +66,7 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,11 +108,17 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_client.py b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_client.py index 847da13f39c..6535fd9a914 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_client.py @@ -21,7 +21,7 @@ class ApiKeyClient(ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_configuration.py b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_configuration.py index c215569421b..7c9664a93b8 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_configuration.py @@ -20,7 +20,7 @@ class ApiKeyClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential """ diff --git a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py index 9a927a45182..e1431dad570 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-api-key/authentication/apikey/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from corehttp.exceptions import ( ClientAuthenticationError, @@ -19,9 +20,15 @@ from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime.pipeline import PipelineResponse +from ... import models as _models +from ..._model_base import _deserialize from ..._operations._operations import build_api_key_invalid_request, build_api_key_valid_request from .._vendor import ApiKeyClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +41,7 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -76,11 +83,17 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_client.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_client.py index f02e8aebffd..17fd6186c85 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_client.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_client.py @@ -21,7 +21,7 @@ class CustomClient(CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_configuration.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_configuration.py index a4312ff5440..6180e05898c 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_configuration.py @@ -20,7 +20,7 @@ class CustomClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential """ diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py index d30efd1fc22..3a59b0c5142 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from corehttp.exceptions import ( ClientAuthenticationError, @@ -18,10 +19,17 @@ ) from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime.pipeline import PipelineResponse +from corehttp.utils import case_insensitive_dict +from .. import models as _models +from .._model_base import _deserialize from .._serialization import Serializer from .._vendor import CustomClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,10 +45,17 @@ def build_custom_valid_request(**kwargs: Any) -> HttpRequest: def build_custom_invalid_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/authentication/http/custom/invalid" - return HttpRequest(method="GET", url=_url, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) class CustomClientOperationsMixin(CustomClientMixinABC): @@ -51,7 +66,7 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,11 +108,17 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_client.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_client.py index 4dbdbe07d27..2a3e31d6dc7 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_client.py @@ -21,7 +21,7 @@ class CustomClient(CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_configuration.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_configuration.py index 8277f82c4cf..c6c170a665b 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_configuration.py @@ -20,7 +20,7 @@ class CustomClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential """ diff --git a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py index a3b72c7dccc..4194ba1b825 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-http-custom/authentication/http/custom/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from corehttp.exceptions import ( ClientAuthenticationError, @@ -19,9 +20,15 @@ from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime.pipeline import PipelineResponse +from ... import models as _models +from ..._model_base import _deserialize from ..._operations._operations import build_custom_invalid_request, build_custom_valid_request from .._vendor import CustomClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +41,7 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -76,11 +83,17 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_client.py b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_client.py index a4f760aee24..f8fdb8c79f1 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_client.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_client.py @@ -24,7 +24,7 @@ class OAuth2Client(OAuth2ClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with OAuth2 authentication. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.TokenCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_configuration.py b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_configuration.py index 452de11e820..03cbf6c32be 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_configuration.py @@ -23,7 +23,7 @@ class OAuth2ClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.TokenCredential """ diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py index 51a856e4f17..8b994f4e842 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from corehttp.exceptions import ( ClientAuthenticationError, @@ -18,10 +19,17 @@ ) from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime.pipeline import PipelineResponse +from corehttp.utils import case_insensitive_dict +from .. import models as _models +from .._model_base import _deserialize from .._serialization import Serializer from .._vendor import OAuth2ClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,10 +45,17 @@ def build_oauth2_valid_request(**kwargs: Any) -> HttpRequest: def build_oauth2_invalid_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + # Construct URL _url = "/authentication/oauth2/invalid" - return HttpRequest(method="GET", url=_url, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) class OAuth2ClientOperationsMixin(OAuth2ClientMixinABC): @@ -51,7 +66,7 @@ def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,11 +108,17 @@ def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_client.py b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_client.py index 9a6f3ed0f9e..4558c233d14 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_client.py @@ -24,7 +24,7 @@ class OAuth2Client(OAuth2ClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with OAuth2 authentication. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.AsyncTokenCredential :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_configuration.py b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_configuration.py index 685017bf739..38ed2fb9f6c 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_configuration.py @@ -23,7 +23,7 @@ class OAuth2ClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to cloud service. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~corehttp.credentials.AsyncTokenCredential """ diff --git a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py index c765a57c525..f1da5a1abfd 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-oauth2/authentication/oauth2/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast from corehttp.exceptions import ( ClientAuthenticationError, @@ -19,9 +20,15 @@ from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime.pipeline import PipelineResponse +from ... import models as _models +from ..._model_base import _deserialize from ..._operations._operations import build_oauth2_invalid_request, build_oauth2_valid_request from .._vendor import OAuth2ClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +41,7 @@ async def valid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -76,11 +83,17 @@ async def invalid(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, + 403: cast( + Type[HttpResponseError], + lambda response: HttpResponseError( + response=response, model=_deserialize(_models.InvalidAuth, response.json()) + ), + ), } error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_client.py b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_client.py index 4d56558c23f..c6b67600f01 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_client.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_client.py @@ -25,7 +25,7 @@ class UnionClient(UnionClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey and OAuth2 authentication. - :param credential: Credential needed for the client to connect to cloud service. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a ServiceKeyCredential type or a TokenCredential type. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential or ~corehttp.credentials.TokenCredential diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_configuration.py b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_configuration.py index 41f891ef080..256ebfe8f1c 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_configuration.py @@ -24,7 +24,7 @@ class UnionClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to cloud service. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a ServiceKeyCredential type or a TokenCredential type. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential or ~corehttp.credentials.TokenCredential diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_operations/_operations.py index f93726e88eb..66e6aed63c5 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from .._serialization import Serializer from .._vendor import UnionClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def valid_key(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +98,7 @@ def valid_token(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_client.py b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_client.py index dc1507bfbfa..37df79b82ac 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_client.py @@ -25,7 +25,7 @@ class UnionClient(UnionClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey and OAuth2 authentication. - :param credential: Credential needed for the client to connect to cloud service. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a ServiceKeyCredential type or a TokenCredential type. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential or ~corehttp.credentials.AsyncTokenCredential diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_configuration.py b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_configuration.py index f936d03cc69..eda62f74ae3 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_configuration.py @@ -24,7 +24,7 @@ class UnionClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to cloud service. Is either a + :param credential: Credential used to authenticate requests to the service. Is either a ServiceKeyCredential type or a TokenCredential type. Required. :type credential: ~corehttp.credentials.ServiceKeyCredential or ~corehttp.credentials.AsyncTokenCredential diff --git a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_operations/_operations.py index 1702b5d99af..e1e517f7c41 100644 --- a/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/authentication-union/authentication/union/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from ..._operations._operations import build_union_valid_key_request, build_union_valid_token_request from .._vendor import UnionClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +39,7 @@ async def valid_key(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -76,7 +81,7 @@ async def valid_token(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/_client.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/_client.py index 29a2095f2c2..65f86ebd6f5 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/_client.py @@ -14,7 +14,7 @@ from ._configuration import NamingClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import ModelOperations, NamingClientOperationsMixin +from .operations import ModelOperations, NamingClientOperationsMixin, UnionEnumOperations class NamingClient(NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword @@ -22,6 +22,8 @@ class NamingClient(NamingClientOperationsMixin): # pylint: disable=client-accep :ivar model: ModelOperations operations :vartype model: client.naming.operations.ModelOperations + :ivar union_enum: UnionEnumOperations operations + :vartype union_enum: client.naming.operations.UnionEnumOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -47,6 +49,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._deserialize = Deserializer() self._serialize.client_side_validation = False self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) + self.union_enum = UnionEnumOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/_client.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/_client.py index c6895ba9e48..567545362a4 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/_client.py @@ -14,7 +14,7 @@ from .._serialization import Deserializer, Serializer from ._configuration import NamingClientConfiguration -from .operations import ModelOperations, NamingClientOperationsMixin +from .operations import ModelOperations, NamingClientOperationsMixin, UnionEnumOperations class NamingClient(NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword @@ -22,6 +22,8 @@ class NamingClient(NamingClientOperationsMixin): # pylint: disable=client-accep :ivar model: ModelOperations operations :vartype model: client.naming.aio.operations.ModelOperations + :ivar union_enum: UnionEnumOperations operations + :vartype union_enum: client.naming.aio.operations.UnionEnumOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -47,6 +49,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._deserialize = Deserializer() self._serialize.client_side_validation = False self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) + self.union_enum = UnionEnumOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/__init__.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/__init__.py index 1f3f5d15a4b..e05e042f528 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/__init__.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from ._operations import ModelOperations +from ._operations import UnionEnumOperations from ._operations import NamingClientOperationsMixin from ._patch import __all__ as _patch_all @@ -15,6 +16,7 @@ __all__ = [ "ModelOperations", + "UnionEnumOperations", "NamingClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/_operations.py index f109b8ec9d5..775e65ea4b4 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -35,6 +35,8 @@ build_naming_parameter_request, build_naming_request_request, build_naming_response_request, + build_union_enum_union_enum_member_name_request, + build_union_enum_union_enum_name_request, ) from .._vendor import NamingClientMixinABC @@ -139,7 +141,7 @@ async def client( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +261,7 @@ async def language( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -305,6 +307,126 @@ async def language( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore +class UnionEnumOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~client.naming.aio.NamingClient`'s + :attr:`union_enum` attribute. + """ + + 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") + + async def union_enum_name( # pylint: disable=inconsistent-return-statements + self, body: Union[str, _models.ClientExtensibleEnum], **kwargs: Any + ) -> None: + """union_enum_name. + + :param body: "value1" Required. + :type body: str or ~client.naming.models.ClientExtensibleEnum + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_union_enum_name_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def union_enum_member_name( # pylint: disable=inconsistent-return-statements + self, body: Union[str, _models.ExtensibleEnum], **kwargs: Any + ) -> None: + """union_enum_member_name. + + :param body: Known values are: "value1" and "value2". Required. + :type body: str or ~client.naming.models.ExtensibleEnum + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_union_enum_member_name_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + class NamingClientOperationsMixin(NamingClientMixinABC): async def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """client_name. @@ -313,7 +435,7 @@ async def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +481,7 @@ async def parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +592,7 @@ async def client( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +712,7 @@ async def language( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +833,7 @@ async def compatible_with_encoded_name( # pylint: disable=inconsistent-return-s "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -767,7 +889,7 @@ async def request( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -810,7 +932,7 @@ async def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/models/__init__.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/models/__init__.py index 161e5330829..170599382ea 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/models/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/models/__init__.py @@ -11,6 +11,9 @@ from ._models import ClientNameModel from ._models import LanguageClientNameModel from ._models import PythonModel + +from ._enums import ClientExtensibleEnum +from ._enums import ExtensibleEnum from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -21,6 +24,8 @@ "ClientNameModel", "LanguageClientNameModel", "PythonModel", + "ClientExtensibleEnum", + "ExtensibleEnum", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/_enums.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/models/_enums.py similarity index 63% rename from packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/_enums.py rename to packages/typespec-python/test/unbranded/generated/client-naming/client/naming/models/_enums.py index c8361062866..7d8776d3a19 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/_enums.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/models/_enums.py @@ -10,8 +10,14 @@ from corehttp.utils import CaseInsensitiveEnumMeta -class ImmediateSuccessResponse(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of ImmediateSuccessResponse.""" +class ClientExtensibleEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ClientExtensibleEnum.""" - ACCEPTED = "accepted" - REJECTED = "rejected" + ENUM_VALUE1 = "value1" + + +class ExtensibleEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ExtensibleEnum.""" + + CLIENT_ENUM_VALUE1 = "value1" + CLIENT_ENUM_VALUE2 = "value2" diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/__init__.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/__init__.py index 1f3f5d15a4b..e05e042f528 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/__init__.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from ._operations import ModelOperations +from ._operations import UnionEnumOperations from ._operations import NamingClientOperationsMixin from ._patch import __all__ as _patch_all @@ -15,6 +16,7 @@ __all__ = [ "ModelOperations", + "UnionEnumOperations", "NamingClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/_operations.py index 8269a76510d..cbb947afb7a 100644 --- a/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-naming/client/naming/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -68,6 +68,32 @@ def build_model_language_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) +def build_union_enum_union_enum_name_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/client/naming/union-enum/union-enum-name" + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +def build_union_enum_union_enum_member_name_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/client/naming/union-enum/union-enum-member-name" + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + def build_naming_client_name_request(**kwargs: Any) -> HttpRequest: # Construct URL _url = "/client/naming/operation" @@ -240,7 +266,7 @@ def client( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +386,7 @@ def language( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,6 +432,126 @@ def language( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, {}) # type: ignore +class UnionEnumOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~client.naming.NamingClient`'s + :attr:`union_enum` attribute. + """ + + 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") + + def union_enum_name( # pylint: disable=inconsistent-return-statements + self, body: Union[str, _models.ClientExtensibleEnum], **kwargs: Any + ) -> None: + """union_enum_name. + + :param body: "value1" Required. + :type body: str or ~client.naming.models.ClientExtensibleEnum + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_union_enum_name_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def union_enum_member_name( # pylint: disable=inconsistent-return-statements + self, body: Union[str, _models.ExtensibleEnum], **kwargs: Any + ) -> None: + """union_enum_member_name. + + :param body: Known values are: "value1" and "value2". Required. + :type body: str or ~client.naming.models.ExtensibleEnum + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_union_enum_member_name_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + class NamingClientOperationsMixin(NamingClientMixinABC): def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """client_name. @@ -414,7 +560,7 @@ def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -458,7 +604,7 @@ def parameter(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,7 +715,7 @@ def client( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -689,7 +835,7 @@ def language( # pylint: disable=inconsistent-return-statements "defaultName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -810,7 +956,7 @@ def compatible_with_encoded_name( # pylint: disable=inconsistent-return-stateme "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -864,7 +1010,7 @@ def request(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -907,7 +1053,7 @@ def response(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retur :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/_client.py b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/_client.py index 0ee2456ea58..1c11d56fa49 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/_client.py @@ -93,7 +93,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/_client.py b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/_client.py index b9f23d52290..1ce30db126d 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/_client.py @@ -95,7 +95,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/operations/_operations.py index 723ae9e3003..c5a20672750 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ ) from .._vendor import ServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +87,7 @@ async def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -101,7 +106,7 @@ async def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -146,7 +151,7 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +170,7 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -192,7 +197,7 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -211,7 +216,7 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -256,7 +261,7 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +280,7 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -302,7 +307,7 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +326,7 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -350,7 +355,7 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +374,7 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -396,7 +401,7 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -415,7 +420,7 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -460,7 +465,7 @@ async def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -479,7 +484,7 @@ async def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -524,7 +529,7 @@ async def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -543,7 +548,7 @@ async def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/operations/_operations.py index 313c616e395..23973f1494c 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-default/client/structure/service/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from .._serialization import Serializer from .._vendor import ServiceClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -138,7 +143,7 @@ def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ def eight(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -202,7 +207,7 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +226,7 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -248,7 +253,7 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +272,7 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -312,7 +317,7 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +336,7 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -358,7 +363,7 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +382,7 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -406,7 +411,7 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -425,7 +430,7 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -452,7 +457,7 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -471,7 +476,7 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -516,7 +521,7 @@ def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -535,7 +540,7 @@ def seven(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -580,7 +585,7 @@ def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -599,7 +604,7 @@ def nine(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_client.py b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_client.py index afaec2efc1b..b3ea08244d5 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_client.py @@ -72,7 +72,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) @@ -143,7 +143,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py index 5d1b1e610cb..8c9bb6f3541 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from .._serialization import Serializer from .._vendor import ClientAClientMixinABC, ClientBClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +84,7 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -98,7 +103,7 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -125,7 +130,7 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +149,7 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -171,7 +176,7 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +195,7 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -219,7 +224,7 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -238,7 +243,7 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -265,7 +270,7 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -284,7 +289,7 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -311,7 +316,7 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -330,7 +335,7 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_client.py b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_client.py index f4539925988..0f18bff3fdc 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_client.py @@ -74,7 +74,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) @@ -147,7 +147,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py index 7c07dd43c18..648d8398100 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-multiclient/client/structure/multiclient/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ ) from .._vendor import ClientAClientMixinABC, ClientBClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -60,7 +65,7 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -87,7 +92,7 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +111,7 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -133,7 +138,7 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,7 +157,7 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -181,7 +186,7 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +205,7 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -227,7 +232,7 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -246,7 +251,7 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -273,7 +278,7 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +297,7 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/_client.py b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/_client.py index fc69f108885..44b0f758abf 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/_client.py @@ -77,7 +77,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py index e1072399d32..5ac5946cfd9 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py @@ -79,7 +79,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py index a51ff4f4b90..626e7f5a228 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ ) from .._vendor import RenamedOperationClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +62,7 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -76,7 +81,7 @@ async def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -103,7 +108,7 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,7 +127,7 @@ async def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsis ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -149,7 +154,7 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +173,7 @@ async def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -197,7 +202,7 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +221,7 @@ async def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsist ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -243,7 +248,7 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +267,7 @@ async def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsi ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -289,7 +294,7 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -308,7 +313,7 @@ async def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsis ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py index 32d8304888c..bf2c77805ce 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-renamedoperation/client/structure/renamedoperation/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from .._serialization import Serializer from .._vendor import RenamedOperationClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -95,7 +100,7 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +119,7 @@ def renamed_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -141,7 +146,7 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -160,7 +165,7 @@ def renamed_four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -187,7 +192,7 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,7 +211,7 @@ def renamed_six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -235,7 +240,7 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -254,7 +259,7 @@ def renamed_one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -281,7 +286,7 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +305,7 @@ def renamed_three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -327,7 +332,7 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +351,7 @@ def renamed_five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py index 6e52bb2c515..16b9e47778f 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py @@ -78,7 +78,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py index b816630a492..95860341713 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py @@ -80,7 +80,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py index dace1f65b81..34e4f1f4257 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ build_group2_two_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,7 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -75,7 +80,7 @@ async def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -102,7 +107,7 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ async def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -148,7 +153,7 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +172,7 @@ async def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -212,7 +217,7 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -231,7 +236,7 @@ async def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -258,7 +263,7 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +282,7 @@ async def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -304,7 +309,7 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -323,7 +328,7 @@ async def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py index ca55b8c8eea..c6040c1c782 100644 --- a/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -21,6 +22,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +99,7 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +118,7 @@ def one(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -140,7 +145,7 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ def three(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-s ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -186,7 +191,7 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +210,7 @@ def four(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -250,7 +255,7 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +274,7 @@ def two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -296,7 +301,7 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +320,7 @@ def five(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-st ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -342,7 +347,7 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +366,7 @@ def six(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "client": self._serialize.url("self._config.client", self._config.client, "str", skip_quote=True), + "client": self._serialize.url("self._config.client", self._config.client, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/aio/operations/_operations.py index c66a3874bec..7d9437f61ff 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -85,7 +85,7 @@ async def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,7 +130,7 @@ async def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +175,7 @@ async def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +222,7 @@ async def base64url_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -377,7 +377,7 @@ async def default( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -530,7 +530,7 @@ async def base64( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -683,7 +683,7 @@ async def base64url( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -853,7 +853,7 @@ async def base64url_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -932,7 +932,7 @@ async def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -977,7 +977,7 @@ async def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1022,7 +1022,7 @@ async def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1069,7 +1069,7 @@ async def base64url_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1132,7 +1132,7 @@ async def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1181,7 +1181,7 @@ async def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: di :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1232,7 +1232,7 @@ async def custom_content_type( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1281,7 +1281,7 @@ async def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1330,7 +1330,7 @@ async def base64url(self, value: bytes, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1395,7 +1395,7 @@ async def default(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1444,7 +1444,7 @@ async def octet_stream(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1490,7 +1490,7 @@ async def custom_content_type(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1536,7 +1536,7 @@ async def base64(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1585,7 +1585,7 @@ async def base64url(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/operations/_operations.py index 4df4c4115ff..7cd507c4f19 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-bytes/encode/bytes/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Iterator, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterator, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -97,9 +97,9 @@ def build_property_default_request(**kwargs: Any) -> HttpRequest: _url = "/encode/bytes/property/default" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -114,9 +114,9 @@ def build_property_base64_request(**kwargs: Any) -> HttpRequest: _url = "/encode/bytes/property/base64" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -131,9 +131,9 @@ def build_property_base64url_request(**kwargs: Any) -> HttpRequest: _url = "/encode/bytes/property/base64url" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -148,9 +148,9 @@ def build_property_base64url_array_request(**kwargs: Any) -> HttpRequest: _url = "/encode/bytes/property/base64url-array" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -206,13 +206,12 @@ def build_header_base64url_array_request(*, value: List[bytes], **kwargs: Any) - def build_request_body_default_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/encode/bytes/body/request/default" # 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) @@ -246,13 +245,12 @@ def build_request_body_custom_content_type_request(**kwargs: Any) -> HttpRequest def build_request_body_base64_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/encode/bytes/body/request/base64" # 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) @@ -260,13 +258,12 @@ def build_request_body_base64_request(**kwargs: Any) -> HttpRequest: def build_request_body_base64url_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/encode/bytes/body/request/base64url" # 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) @@ -367,7 +364,7 @@ def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +409,7 @@ def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +454,7 @@ def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +501,7 @@ def base64url_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -659,7 +656,7 @@ def default( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -812,7 +809,7 @@ def base64( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -965,7 +962,7 @@ def base64url( "value": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1135,7 +1132,7 @@ def base64url_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1214,7 +1211,7 @@ def default(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=in :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1259,7 +1256,7 @@ def base64(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1304,7 +1301,7 @@ def base64url(self, *, value: bytes, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1351,7 +1348,7 @@ def base64url_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1414,7 +1411,7 @@ def default(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1463,7 +1460,7 @@ def octet_stream(self, value: bytes, **kwargs: Any) -> None: # pylint: disable= :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1514,7 +1511,7 @@ def custom_content_type( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1563,7 +1560,7 @@ def base64(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1612,7 +1609,7 @@ def base64url(self, value: bytes, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1677,7 +1674,7 @@ def default(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1726,7 +1723,7 @@ def octet_stream(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1772,7 +1769,7 @@ def custom_content_type(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1818,7 +1815,7 @@ def base64(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1867,7 +1864,7 @@ def base64url(self, **kwargs: Any) -> bytes: :rtype: bytes :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/aio/operations/_operations.py index 99fbb8badde..7469800ba2e 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/aio/operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -85,7 +85,7 @@ async def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +132,7 @@ async def rfc3339( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,7 +179,7 @@ async def rfc7231( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -226,7 +226,7 @@ async def unix_timestamp( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +273,7 @@ async def unix_timestamp_array( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +428,7 @@ async def default( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -581,7 +581,7 @@ async def rfc3339( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -734,7 +734,7 @@ async def rfc7231( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -892,7 +892,7 @@ async def unix_timestamp( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1062,7 +1062,7 @@ async def unix_timestamp_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1143,7 +1143,7 @@ async def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1190,7 +1190,7 @@ async def rfc3339( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1237,7 +1237,7 @@ async def rfc7231( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1284,7 +1284,7 @@ async def unix_timestamp( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1331,7 +1331,7 @@ async def unix_timestamp_array( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1392,7 +1392,7 @@ async def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1437,7 +1437,7 @@ async def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1482,7 +1482,7 @@ async def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1527,7 +1527,7 @@ async def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/operations/_operations.py index 075f5df5e96..74c6f38e5a7 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-datetime/encode/datetime/operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -110,9 +110,9 @@ def build_property_default_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/default" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -127,9 +127,9 @@ def build_property_rfc3339_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/rfc3339" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -144,9 +144,9 @@ def build_property_rfc7231_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/rfc7231" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -161,9 +161,9 @@ def build_property_unix_timestamp_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/unix-timestamp" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -178,9 +178,9 @@ def build_property_unix_timestamp_array_request(**kwargs: Any) -> HttpRequest: _url = "/encode/datetime/property/unix-timestamp-array" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -303,7 +303,7 @@ def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +350,7 @@ def rfc3339( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -397,7 +397,7 @@ def rfc7231( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +444,7 @@ def unix_timestamp( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +491,7 @@ def unix_timestamp_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -646,7 +646,7 @@ def default( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -799,7 +799,7 @@ def rfc3339( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -952,7 +952,7 @@ def rfc7231( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1110,7 +1110,7 @@ def unix_timestamp( "value": "2020-02-20 00:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1280,7 +1280,7 @@ def unix_timestamp_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1361,7 +1361,7 @@ def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1408,7 +1408,7 @@ def rfc3339( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1455,7 +1455,7 @@ def rfc7231( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1502,7 +1502,7 @@ def unix_timestamp( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1549,7 +1549,7 @@ def unix_timestamp_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1610,7 +1610,7 @@ def default(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1655,7 +1655,7 @@ def rfc3339(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1700,7 +1700,7 @@ def rfc7231(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1745,7 +1745,7 @@ def unix_timestamp(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/aio/operations/_operations.py index dae54304c23..c1adc7bc3de 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/aio/operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -81,7 +81,7 @@ async def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -128,7 +128,7 @@ async def iso8601( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,7 +175,7 @@ async def int32_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +222,7 @@ async def float_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +269,7 @@ async def int32_seconds_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +424,7 @@ async def default( "value": "1 day, 0:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -577,7 +577,7 @@ async def iso8601( "value": "1 day, 0:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -735,7 +735,7 @@ async def int32_seconds( "value": 0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +893,7 @@ async def float_seconds( "value": 0.0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1063,7 +1063,7 @@ async def float_seconds_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1144,7 +1144,7 @@ async def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1191,7 +1191,7 @@ async def iso8601( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1238,7 +1238,7 @@ async def iso8601_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1285,7 +1285,7 @@ async def int32_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1332,7 +1332,7 @@ async def float_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/operations/_operations.py index d12a2a3c53b..cec9ea877b6 100644 --- a/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/encode-duration/encode/duration/operations/_operations.py @@ -10,7 +10,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -110,9 +110,9 @@ def build_property_default_request(**kwargs: Any) -> HttpRequest: _url = "/encode/duration/property/default" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -127,9 +127,9 @@ def build_property_iso8601_request(**kwargs: Any) -> HttpRequest: _url = "/encode/duration/property/iso8601" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -144,9 +144,9 @@ def build_property_int32_seconds_request(**kwargs: Any) -> HttpRequest: _url = "/encode/duration/property/int32-seconds" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -161,9 +161,9 @@ def build_property_float_seconds_request(**kwargs: Any) -> HttpRequest: _url = "/encode/duration/property/float-seconds" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -178,9 +178,9 @@ def build_property_float_seconds_array_request(**kwargs: Any) -> HttpRequest: # _url = "/encode/duration/property/float-seconds-array" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -273,7 +273,7 @@ def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,7 +320,7 @@ def iso8601( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -365,7 +365,7 @@ def int32_seconds(self, *, input: int, **kwargs: Any) -> None: # pylint: disabl :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +410,7 @@ def float_seconds(self, *, input: float, **kwargs: Any) -> None: # pylint: disa :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +457,7 @@ def int32_seconds_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -612,7 +612,7 @@ def default( "value": "1 day, 0:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +765,7 @@ def iso8601( "value": "1 day, 0:00:00" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -923,7 +923,7 @@ def int32_seconds( "value": 0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1081,7 +1081,7 @@ def float_seconds( "value": 0.0 # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1251,7 +1251,7 @@ def float_seconds_array( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1332,7 +1332,7 @@ def default( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1379,7 +1379,7 @@ def iso8601( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1426,7 +1426,7 @@ def iso8601_array( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1471,7 +1471,7 @@ def int32_seconds(self, *, duration: int, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1518,7 +1518,7 @@ def float_seconds( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py index 014daea6688..5dfbe56bf73 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -50,9 +50,9 @@ def build_visibility_get_model_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/visibility" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="GET", url=_url, headers=_headers, **kwargs) @@ -289,7 +289,7 @@ def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,7 +436,7 @@ def head_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -576,7 +576,7 @@ def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +716,7 @@ def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -856,7 +856,7 @@ def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -996,7 +996,7 @@ def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py index 81555f89149..abc38d900b6 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/headasbooleanfalse/headasbooleanfalse/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -206,7 +206,7 @@ async def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +353,7 @@ async def head_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -493,7 +493,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +633,7 @@ async def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -773,7 +773,7 @@ async def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -913,7 +913,7 @@ async def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py index 2d43d53e5d9..0059f6c07ca 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -50,9 +50,9 @@ def build_visibility_get_model_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/visibility" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="GET", url=_url, headers=_headers, **kwargs) @@ -289,7 +289,7 @@ def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +430,7 @@ def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes]], **k ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +571,7 @@ def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +711,7 @@ def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -851,7 +851,7 @@ def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -991,7 +991,7 @@ def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py index 3cef8194cd9..81ee2c3cb6b 100644 --- a/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/headasbooleantrue/headasbooleantrue/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -206,7 +206,7 @@ async def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +347,7 @@ async def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes] ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +488,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -628,7 +628,7 @@ async def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +768,7 @@ async def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -908,7 +908,7 @@ async def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py index 9a14a93164c..9700222eb38 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -134,7 +134,7 @@ async def set( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +257,7 @@ async def omit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -382,7 +382,7 @@ async def required_explicit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -502,7 +502,7 @@ async def required_implicit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py index d9aa5870aae..1ba9cdc63c7 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-body-optionality/parameters/bodyoptionality/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -188,7 +188,7 @@ def set( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -311,7 +311,7 @@ def omit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -436,7 +436,7 @@ def required_explicit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +556,7 @@ def required_implicit( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py index 9911f3a4a38..bc8864a079c 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ build_query_tsv_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ async def multi( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +110,7 @@ async def ssv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +155,7 @@ async def tsv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +202,7 @@ async def pipes( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,7 +247,7 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -305,7 +310,7 @@ async def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py index ada8c6ad699..d28c8e8524f 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-collection-format/parameters/collectionformat/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -127,7 +132,7 @@ def multi(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -172,7 +177,7 @@ def ssv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -217,7 +222,7 @@ def tsv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -262,7 +267,7 @@ def pipes(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,7 +312,7 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -370,7 +375,7 @@ def csv(self, *, colors: List[str], **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/aio/operations/_operations.py index d1716daa596..b49905edfc4 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -134,7 +134,7 @@ async def spread_as_request_body( # pylint: disable=inconsistent-return-stateme "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +274,7 @@ async def spread_as_request_body( # pylint: disable=inconsistent-return-stateme "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +423,7 @@ async def spread_as_request_parameter( # pylint: disable=inconsistent-return-st "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +620,7 @@ async def spread_with_multiple_parameters( # pylint: disable=inconsistent-retur "prop6": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/operations/_operations.py index 3acdb7e9a5d..da88fa29732 100644 --- a/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/parameters-spread/parameters/spread/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -204,7 +204,7 @@ def spread_as_request_body( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,7 +344,7 @@ def spread_as_request_body( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -493,7 +493,7 @@ def spread_as_request_parameter( # pylint: disable=inconsistent-return-statemen "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -690,7 +690,7 @@ def spread_with_multiple_parameters( # pylint: disable=inconsistent-return-stat "prop6": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/payload/contentnegotiation/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/payload/contentnegotiation/aio/operations/_operations.py index f55123b3598..32ba8693df0 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/payload/contentnegotiation/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/payload/contentnegotiation/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_same_body_get_avatar_as_png_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +62,7 @@ async def get_avatar_as_png(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,7 +110,7 @@ async def get_avatar_as_jpeg(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +176,7 @@ async def get_avatar_as_png(self, **kwargs: Any) -> AsyncIterator[bytes]: :rtype: AsyncIterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +232,7 @@ async def get_avatar_as_json(self, **kwargs: Any) -> _models.PngImageAsJson: "content": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/payload/contentnegotiation/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/payload/contentnegotiation/operations/_operations.py index 8a880ce68d5..93183eaceab 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/payload/contentnegotiation/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-content-negotiation/payload/contentnegotiation/operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterator, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterator, Literal, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._model_base import _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -107,7 +112,7 @@ def get_avatar_as_png(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,7 +160,7 @@ def get_avatar_as_jpeg(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +226,7 @@ def get_avatar_as_png(self, **kwargs: Any) -> Iterator[bytes]: :rtype: Iterator[bytes] :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -277,7 +282,7 @@ def get_avatar_as_json(self, **kwargs: Any) -> _models.PngImageAsJson: "content": bytes("bytes", encoding="utf-8") # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py index 8d5272157be..5445f295927 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -50,9 +50,9 @@ def build_json_merge_patch_create_resource_request(**kwargs: Any) -> HttpRequest _url = "/json-merge-patch/create/resource" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, headers=_headers, **kwargs) @@ -323,7 +323,7 @@ def create_resource(self, body: Union[_models.Resource, JSON, IO[bytes]], **kwar } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -604,7 +604,7 @@ def update_resource(self, body: Union[_models.ResourcePatch, JSON, IO[bytes]], * } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -892,7 +892,7 @@ def update_optional_resource( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py index 1a6b088e4e1..5a4e4a40a06 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -273,7 +273,7 @@ async def create_resource(self, body: Union[_models.Resource, JSON, IO[bytes]], } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -556,7 +556,7 @@ async def update_resource( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -844,7 +844,7 @@ async def update_optional_resource( } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py index 743b1c3f145..5e12b43861f 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_string_body_send_as_text_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +64,7 @@ async def send_as_text(self, text: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,7 +111,7 @@ async def get_as_text(self, **kwargs: Any) -> str: :rtype: str :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +162,7 @@ async def send_as_json(self, text: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -204,7 +209,7 @@ async def get_as_json(self, **kwargs: Any) -> str: :rtype: str :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/operations/_operations.py index ec85980543d..9850c980f55 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-media-type/payload/mediatype/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -111,7 +116,7 @@ def send_as_text(self, text: str, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,7 +163,7 @@ def get_as_text(self, **kwargs: Any) -> str: :rtype: str :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +214,7 @@ def send_as_json(self, text: str, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +261,7 @@ def get_as_json(self, **kwargs: Any) -> str: :rtype: str :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/aio/operations/_operations.py index d3d38efaa96..9e8c4b31e2a 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/aio/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -111,7 +111,7 @@ async def basic( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -224,7 +224,7 @@ async def complex( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -323,7 +323,7 @@ async def json_part( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +420,7 @@ async def binary_array_parts( # pylint: disable=inconsistent-return-statements "pictures": [filetype] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -525,7 +525,7 @@ async def json_array_parts( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +622,7 @@ async def multi_binary_parts( # pylint: disable=inconsistent-return-statements "picture": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -719,7 +719,7 @@ async def check_file_name_and_content_type( # pylint: disable=inconsistent-retu "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/operations/_operations.py index 7d236d3e866..6df9e814b8b 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-multipart/payload/multipart/operations/_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -172,7 +172,7 @@ def basic( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -285,7 +285,7 @@ def complex( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -384,7 +384,7 @@ def json_part( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -479,7 +479,7 @@ def binary_array_parts( # pylint: disable=inconsistent-return-statements "pictures": [filetype] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -582,7 +582,7 @@ def json_array_parts( # pylint: disable=inconsistent-return-statements "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -677,7 +677,7 @@ def multi_binary_parts( # pylint: disable=inconsistent-return-statements "picture": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +774,7 @@ def check_file_name_and_content_type( # pylint: disable=inconsistent-return-sta "profileImage": filetype } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py index 73ee318c4c8..adb35cca3e6 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, List, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import PageableClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.User"]: maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py index 99f7d10684c..4e404e95684 100644 --- a/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/payload-pageable/payload/pageable/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from ..._operations._operations import build_pageable_list_request from .._vendor import PageableClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.User"]: maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.User]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/projection-projected-name/MANIFEST.in deleted file mode 100644 index f92d86cb718..00000000000 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include *.md -include LICENSE -include projection/projectedname/py.typed -recursive-include tests *.py -recursive-include samples *.py *.md -include projection/__init__.py \ No newline at end of file diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/operations/__init__.py b/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/operations/__init__.py deleted file mode 100644 index 932f36fa47f..00000000000 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Unbranded Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Unbranded (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import PropertyOperations -from ._operations import ModelOperations -from ._operations import ProjectedNameClientOperationsMixin - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "PropertyOperations", - "ModelOperations", - "ProjectedNameClientOperationsMixin", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/operations/_operations.py deleted file mode 100644 index eeb536d0bb9..00000000000 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/operations/_operations.py +++ /dev/null @@ -1,896 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Unbranded Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Unbranded (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from corehttp.rest import AsyncHttpResponse, HttpRequest -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from ... import models as _models -from ..._model_base import SdkJSONEncoder -from ...operations._operations import ( - build_model_client_request, - build_model_language_request, - build_projected_name_client_name_request, - build_projected_name_parameter_request, - build_property_client_request, - build_property_json_and_client_request, - build_property_json_request, - build_property_language_request, -) -from .._vendor import ProjectedNameClientMixinABC - -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 -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~projection.projectedname.aio.ProjectedNameClient`'s - :attr:`property` attribute. - """ - - 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") - - @overload - async def json( # pylint: disable=inconsistent-return-statements - self, body: _models.JsonProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: ~projection.projectedname.models.JsonProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - - @overload - async def json( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def json( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def json( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.JsonProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """json. - - :param body: Is one of the following types: JsonProjectedNameModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.JsonProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_json_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: _models.ClientProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~projection.projectedname.models.ClientProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is one of the following types: ClientProjectedNameModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.ClientProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: _models.LanguageProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~projection.projectedname.models.LanguageProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.LanguageProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is one of the following types: LanguageProjectedNameModel, JSON, IO[bytes] - Required. - :type body: ~projection.projectedname.models.LanguageProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: _models.JsonAndClientProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: ~projection.projectedname.models.JsonAndClientProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - - @overload - async def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.JsonAndClientProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Is one of the following types: JsonAndClientProjectedNameModel, JSON, IO[bytes] - Required. - :type body: ~projection.projectedname.models.JsonAndClientProjectedNameModel or JSON or - IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_json_and_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ModelOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~projection.projectedname.aio.ProjectedNameClient`'s - :attr:`model` attribute. - """ - - 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") - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: _models.ClientModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~projection.projectedname.models.ClientModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is one of the following types: ClientModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.ClientModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: _models.PythonModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~projection.projectedname.models.PythonModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - async def language( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - async def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.PythonModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is one of the following types: PythonModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.PythonModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ProjectedNameClientOperationsMixin(ProjectedNameClientMixinABC): - async def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """client_name. - - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_projected_name_client_name_request( - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - async def parameter( # pylint: disable=inconsistent-return-statements - self, *, client_name: str, **kwargs: Any - ) -> None: - """parameter. - - :keyword client_name: Required. - :paramtype client_name: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_projected_name_parameter_request( - client_name=client_name, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - await response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/models/__init__.py b/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/models/__init__.py deleted file mode 100644 index 4d7d268c4a8..00000000000 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/models/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Unbranded Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Unbranded (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models import ClientModel -from ._models import ClientProjectedNameModel -from ._models import JsonAndClientProjectedNameModel -from ._models import JsonProjectedNameModel -from ._models import LanguageProjectedNameModel -from ._models import PythonModel -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ClientModel", - "ClientProjectedNameModel", - "JsonAndClientProjectedNameModel", - "JsonProjectedNameModel", - "LanguageProjectedNameModel", - "PythonModel", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/models/_models.py b/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/models/_models.py deleted file mode 100644 index 70e2c743a75..00000000000 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/models/_models.py +++ /dev/null @@ -1,199 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Unbranded Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Unbranded (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Mapping, overload - -from .. import _model_base -from .._model_base import rest_field - - -class ClientModel(_model_base.Model): - """ClientModel. - - All required parameters must be populated in order to send to server. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - default_name: bool = rest_field(name="defaultName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - default_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class ClientProjectedNameModel(_model_base.Model): - """ClientProjectedNameModel. - - All required parameters must be populated in order to send to server. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - client_name: bool = rest_field(name="defaultName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - client_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class JsonAndClientProjectedNameModel(_model_base.Model): - """JsonAndClientProjectedNameModel. - - All required parameters must be populated in order to send to server. - - :ivar client_name: Pass in true. Required. - :vartype client_name: bool - """ - - client_name: bool = rest_field(name="wireName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - client_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class JsonProjectedNameModel(_model_base.Model): - """JsonProjectedNameModel. - - All required parameters must be populated in order to send to server. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - default_name: bool = rest_field(name="wireName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - default_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class LanguageProjectedNameModel(_model_base.Model): - """LanguageProjectedNameModel. - - All required parameters must be populated in order to send to server. - - :ivar python_name: Pass in true. Required. - :vartype python_name: bool - """ - - python_name: bool = rest_field(name="defaultName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - python_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) - - -class PythonModel(_model_base.Model): - """PythonModel. - - All required parameters must be populated in order to send to server. - - :ivar default_name: Pass in true. Required. - :vartype default_name: bool - """ - - default_name: bool = rest_field(name="defaultName") - """Pass in true. Required.""" - - @overload - def __init__( - self, - *, - default_name: bool, - ): - ... - - @overload - def __init__(self, mapping: Mapping[str, Any]): - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation - super().__init__(*args, **kwargs) diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/_operations.py deleted file mode 100644 index 005592e3282..00000000000 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/_operations.py +++ /dev/null @@ -1,991 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Unbranded Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Unbranded (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import json -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload - -from corehttp.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from corehttp.rest import HttpRequest, HttpResponse -from corehttp.runtime.pipeline import PipelineResponse -from corehttp.utils import case_insensitive_dict - -from .. import models as _models -from .._model_base import SdkJSONEncoder -from .._serialization import Serializer -from .._vendor import ProjectedNameClientMixinABC - -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 -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_property_json_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/property/json" - - # 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_property_client_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/property/client" - - # 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_property_language_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/property/language" - - # 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_property_json_and_client_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/property/json-and-client" - - # 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_model_client_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/model/client" - - # 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_model_language_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - # Construct URL - _url = "/projection/projected-name/model/language" - - # 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_projected_name_client_name_request(**kwargs: Any) -> HttpRequest: - # Construct URL - _url = "/projection/projected-name/operation" - - return HttpRequest(method="POST", url=_url, **kwargs) - - -def build_projected_name_parameter_request(*, client_name: str, **kwargs: Any) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - # Construct URL - _url = "/projection/projected-name/parameter" - - # Construct parameters - _params["default-name"] = _SERIALIZER.query("client_name", client_name, "str") - - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) - - -class PropertyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~projection.projectedname.ProjectedNameClient`'s - :attr:`property` attribute. - """ - - 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") - - @overload - def json( # pylint: disable=inconsistent-return-statements - self, body: _models.JsonProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: ~projection.projectedname.models.JsonProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - - @overload - def json( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def json( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def json( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.JsonProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """json. - - :param body: Is one of the following types: JsonProjectedNameModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.JsonProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_json_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: _models.ClientProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~projection.projectedname.models.ClientProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is one of the following types: ClientProjectedNameModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.ClientProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: _models.LanguageProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~projection.projectedname.models.LanguageProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.LanguageProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is one of the following types: LanguageProjectedNameModel, JSON, IO[bytes] - Required. - :type body: ~projection.projectedname.models.LanguageProjectedNameModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: _models.JsonAndClientProjectedNameModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: ~projection.projectedname.models.JsonAndClientProjectedNameModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - - @overload - def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def json_and_client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.JsonAndClientProjectedNameModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """json_and_client. - - :param body: Is one of the following types: JsonAndClientProjectedNameModel, JSON, IO[bytes] - Required. - :type body: ~projection.projectedname.models.JsonAndClientProjectedNameModel or JSON or - IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "wireName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_property_json_and_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ModelOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~projection.projectedname.ProjectedNameClient`'s - :attr:`model` attribute. - """ - - 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") - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: _models.ClientModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: ~projection.projectedname.models.ClientModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def client( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """client. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def client( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.ClientModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """client. - - :param body: Is one of the following types: ClientModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.ClientModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_client_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: _models.PythonModel, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: ~projection.projectedname.models.PythonModel - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - @overload - def language( # pylint: disable=inconsistent-return-statements - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> None: - """language. - - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - - def language( # pylint: disable=inconsistent-return-statements - self, body: Union[_models.PythonModel, JSON, IO[bytes]], **kwargs: Any - ) -> None: - """language. - - :param body: Is one of the following types: PythonModel, JSON, IO[bytes] Required. - :type body: ~projection.projectedname.models.PythonModel or JSON or IO[bytes] - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - body = { - "defaultName": bool # Pass in true. Required. - } - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_model_language_request( - content_type=content_type, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - -class ProjectedNameClientOperationsMixin(ProjectedNameClientMixinABC): - def client_name(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """client_name. - - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_projected_name_client_name_request( - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - def parameter(self, *, client_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """parameter. - - :keyword client_name: Required. - :paramtype client_name: str - :return: None - :rtype: None - :raises ~corehttp.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_projected_name_parameter_request( - client_name=client_name, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - if _stream: - response.read() # Load the body in memory and close the socket - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_client.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_client.py index 861fa8768a1..0886d93beba 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_client.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_client.py @@ -81,14 +81,9 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py index 262bea2722d..bcf016cf60a 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import ResiliencyServiceDrivenClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,7 @@ def from_none(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,14 +102,9 @@ def from_none(self, **kwargs: Any) -> bool: path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -137,7 +137,7 @@ def from_one_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -158,14 +158,9 @@ def from_one_required( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -197,7 +192,7 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -218,14 +213,9 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py index b49cdd303d7..577ea50e18a 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py @@ -83,14 +83,9 @@ def send_request( path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py index 61beb9449c1..299e5db0667 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ ) from .._vendor import ResiliencyServiceDrivenClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +46,7 @@ async def from_none(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -61,14 +66,9 @@ async def from_none(self, **kwargs: Any) -> bool: path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -101,7 +101,7 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,14 +122,9 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -161,7 +156,7 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,14 +177,9 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_client.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_client.py index eb8b4a30ca3..41525f8e918 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_client.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_client.py @@ -100,14 +100,9 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py index 1f74b427b24..d131ddf3509 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -24,6 +25,10 @@ from .._validation import api_version_validation from .._vendor import ResiliencyServiceDrivenClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -101,7 +106,7 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,14 +126,9 @@ def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -160,7 +160,7 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,14 +181,9 @@ def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) -> bo path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -226,7 +221,7 @@ def from_one_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -248,14 +243,9 @@ def from_one_required( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -292,7 +282,7 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,14 +304,9 @@ def from_one_optional( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py index f841edcf040..5ed2ddd75eb 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py @@ -102,14 +102,9 @@ def send_request( path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py index e96fd183955..9a3360f28ab 100644 --- a/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,10 @@ from ..._validation import api_version_validation from .._vendor import ResiliencyServiceDrivenClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -65,14 +70,9 @@ async def add_operation(self, **kwargs: Any) -> None: # pylint: disable=inconsi path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -104,7 +104,7 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,14 +125,9 @@ async def from_none(self, *, new_parameter: Optional[str] = None, **kwargs: Any) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -170,7 +165,7 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,14 +187,9 @@ async def from_one_required( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -236,7 +226,7 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,14 +248,9 @@ async def from_one_optional( # pylint: disable=inconsistent-return-statements path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), "serviceDeploymentVersion": self._serialize.url( - "self._config.service_deployment_version", - self._config.service_deployment_version, - "str", - skip_quote=True, - ), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True + "self._config.service_deployment_version", self._config.service_deployment_version, "str" ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py index e301421e1ca..42e131c6aeb 100644 --- a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -128,7 +128,7 @@ async def send( # pylint: disable=inconsistent-return-statements "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -188,7 +188,7 @@ async def get(self, **kwargs: Any) -> _models.JsonEncodedNameModel: "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py index ac691a76244..363d1633548 100644 --- a/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/serialization-encoded-name-json/serialization/encodedname/json/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -159,7 +159,7 @@ def send( # pylint: disable=inconsistent-return-statements "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +219,7 @@ def get(self, **kwargs: Any) -> _models.JsonEncodedNameModel: "wireName": bool # Pass in true. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/CHANGELOG.md b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/CHANGELOG.md new file mode 100644 index 00000000000..628743d283a --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (1970-01-01) + +- Initial version diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/LICENSE b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/LICENSE similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/LICENSE rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/LICENSE diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/MANIFEST.in b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/MANIFEST.in new file mode 100644 index 00000000000..3fb7e5ef0a6 --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/MANIFEST.in @@ -0,0 +1,7 @@ +include *.md +include LICENSE +include server/endpoint/notdefined/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include server/__init__.py +include server/endpoint/__init__.py \ No newline at end of file diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/README.md b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/README.md similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/README.md rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/README.md diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/__init__.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/__init__.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/__init__.py new file mode 100644 index 00000000000..d55ccad1f57 --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/__init__.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/__init__.py similarity index 92% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/__init__.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/__init__.py index 8f29312e529..cef05b2fd7b 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._client import ProjectedNameClient +from ._client import NotDefinedClient from ._version import VERSION __version__ = VERSION @@ -19,7 +19,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ProjectedNameClient", + "NotDefinedClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_client.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_client.py similarity index 70% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_client.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_client.py index 0b691fdd576..89405e307e7 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_client.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_client.py @@ -12,26 +12,24 @@ from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies -from ._configuration import ProjectedNameClientConfiguration +from ._configuration import NotDefinedClientConfiguration +from ._operations import NotDefinedClientOperationsMixin from ._serialization import Deserializer, Serializer -from .operations import ModelOperations, ProjectedNameClientOperationsMixin, PropertyOperations -class ProjectedNameClient(ProjectedNameClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Projection. +class NotDefinedClient(NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let + user pass in. - :ivar property: PropertyOperations operations - :vartype property: projection.projectedname.operations.PropertyOperations - :ivar model: ModelOperations operations - :vartype model: projection.projectedname.operations.ModelOperations - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str + :param endpoint: Service host. Required. + :type endpoint: str """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, endpoint: str, **kwargs: Any ) -> None: - self._config = ProjectedNameClientConfiguration(**kwargs) + _endpoint = "{endpoint}" + self._config = NotDefinedClientConfiguration(endpoint=endpoint, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -43,13 +41,11 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._config.authentication_policy, self._config.logging_policy, ] - self._client: PipelineClient = PipelineClient(endpoint=endpoint, policies=_policies, **kwargs) + self._client: PipelineClient = PipelineClient(endpoint=_endpoint, policies=_policies, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.property = PropertyOperations(self._client, self._config, self._serialize, self._deserialize) - self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -70,13 +66,17 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "ProjectedNameClient": + def __enter__(self) -> "NotDefinedClient": self._client.__enter__() return self diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_configuration.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_configuration.py similarity index 73% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_configuration.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_configuration.py index fc08e1db878..2fe40571549 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_configuration.py @@ -13,16 +13,22 @@ from ._version import VERSION -class ProjectedNameClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ProjectedNameClient. +class NotDefinedClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for NotDefinedClient. Note that all parameters used to create this instance are saved as instance attributes. + + :param endpoint: Service host. Required. + :type endpoint: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__(self, endpoint: str, **kwargs: Any) -> None: + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") - kwargs.setdefault("sdk_moniker", "projection-projectedname/{}".format(VERSION)) + self.endpoint = endpoint + kwargs.setdefault("sdk_moniker", "server-endpoint-notdefined/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_model_base.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_model_base.py similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_model_base.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_model_base.py diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/__init__.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/__init__.py similarity index 87% rename from packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/__init__.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/__init__.py index 39d4f4def9f..0c47b608a7b 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/models/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/__init__.py @@ -6,13 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._enums import ImmediateSuccessResponse +from ._operations import NotDefinedClientOperationsMixin + from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ImmediateSuccessResponse", + "NotDefinedClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py new file mode 100644 index 00000000000..5108f3c98af --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_operations.py @@ -0,0 +1,89 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Unbranded Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Unbranded (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from corehttp.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from corehttp.rest import HttpRequest, HttpResponse +from corehttp.runtime.pipeline import PipelineResponse + +from .._serialization import Serializer +from .._vendor import NotDefinedClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_not_defined_valid_request(**kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/server/endpoint/not-defined/valid" + + return HttpRequest(method="HEAD", url=_url, **kwargs) + + +class NotDefinedClientOperationsMixin(NotDefinedClientMixinABC): + def valid(self, **kwargs: Any) -> bool: + """valid. + + :return: bool + :rtype: bool + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_not_defined_valid_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + return 200 <= response.status_code <= 299 diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_patch.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_patch.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_patch.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_patch.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_serialization.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_serialization.py similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_serialization.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_serialization.py diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_vendor.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_vendor.py similarity index 85% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_vendor.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_vendor.py index d77e6c163c8..4922802a253 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_vendor.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_vendor.py @@ -8,7 +8,7 @@ from abc import ABC from typing import TYPE_CHECKING -from ._configuration import ProjectedNameClientConfiguration +from ._configuration import NotDefinedClientConfiguration if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -17,10 +17,10 @@ from ._serialization import Deserializer, Serializer -class ProjectedNameClientMixinABC(ABC): +class NotDefinedClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "PipelineClient" - _config: ProjectedNameClientConfiguration + _config: NotDefinedClientConfiguration _serialize: "Serializer" _deserialize: "Deserializer" diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_version.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_version.py similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/_version.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/_version.py diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/__init__.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/__init__.py similarity index 91% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/__init__.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/__init__.py index f6c3b2ec237..b7d21c4250d 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._client import ProjectedNameClient +from ._client import NotDefinedClient try: from ._patch import __all__ as _patch_all @@ -16,7 +16,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ProjectedNameClient", + "NotDefinedClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_client.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py similarity index 72% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_client.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py index 3102113dcec..60201b0d281 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py @@ -13,25 +13,23 @@ from corehttp.runtime import AsyncPipelineClient, policies from .._serialization import Deserializer, Serializer -from ._configuration import ProjectedNameClientConfiguration -from .operations import ModelOperations, ProjectedNameClientOperationsMixin, PropertyOperations +from ._configuration import NotDefinedClientConfiguration +from ._operations import NotDefinedClientOperationsMixin -class ProjectedNameClient(ProjectedNameClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword - """Projection. +class NotDefinedClient(NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword + """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let + user pass in. - :ivar property: PropertyOperations operations - :vartype property: projection.projectedname.aio.operations.PropertyOperations - :ivar model: ModelOperations operations - :vartype model: projection.projectedname.aio.operations.ModelOperations - :keyword endpoint: Service host. Default value is "http://localhost:3000". - :paramtype endpoint: str + :param endpoint: Service host. Required. + :type endpoint: str """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential - self, *, endpoint: str = "http://localhost:3000", **kwargs: Any + self, endpoint: str, **kwargs: Any ) -> None: - self._config = ProjectedNameClientConfiguration(**kwargs) + _endpoint = "{endpoint}" + self._config = NotDefinedClientConfiguration(endpoint=endpoint, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -43,13 +41,11 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._config.authentication_policy, self._config.logging_policy, ] - self._client: AsyncPipelineClient = AsyncPipelineClient(endpoint=endpoint, policies=_policies, **kwargs) + self._client: AsyncPipelineClient = AsyncPipelineClient(endpoint=_endpoint, policies=_policies, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() self._serialize.client_side_validation = False - self.property = PropertyOperations(self._client, self._config, self._serialize, self._deserialize) - self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any @@ -72,13 +68,17 @@ def send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "ProjectedNameClient": + async def __aenter__(self) -> "NotDefinedClient": await self._client.__aenter__() return self diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_configuration.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_configuration.py similarity index 73% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_configuration.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_configuration.py index 9ad0b661f94..7344e0528a6 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_configuration.py @@ -13,16 +13,22 @@ from .._version import VERSION -class ProjectedNameClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ProjectedNameClient. +class NotDefinedClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for NotDefinedClient. Note that all parameters used to create this instance are saved as instance attributes. + + :param endpoint: Service host. Required. + :type endpoint: str """ - def __init__(self, **kwargs: Any) -> None: + def __init__(self, endpoint: str, **kwargs: Any) -> None: + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") - kwargs.setdefault("sdk_moniker", "projection-projectedname/{}".format(VERSION)) + self.endpoint = endpoint + kwargs.setdefault("sdk_moniker", "server-endpoint-notdefined/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/__init__.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/__init__.py similarity index 74% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/__init__.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/__init__.py index 932f36fa47f..0c47b608a7b 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/operations/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/__init__.py @@ -6,18 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import PropertyOperations -from ._operations import ModelOperations -from ._operations import ProjectedNameClientOperationsMixin +from ._operations import NotDefinedClientOperationsMixin from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "PropertyOperations", - "ModelOperations", - "ProjectedNameClientOperationsMixin", + "NotDefinedClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py new file mode 100644 index 00000000000..15c4dc95400 --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_operations.py @@ -0,0 +1,79 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Unbranded Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Unbranded (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from corehttp.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from corehttp.rest import AsyncHttpResponse, HttpRequest +from corehttp.runtime.pipeline import PipelineResponse + +from ..._operations._operations import build_not_defined_valid_request +from .._vendor import NotDefinedClientMixinABC + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NotDefinedClientOperationsMixin(NotDefinedClientMixinABC): + async def valid(self, **kwargs: Any) -> bool: + """valid. + + :return: bool + :rtype: bool + :raises ~corehttp.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_not_defined_valid_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client.pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + return 200 <= response.status_code <= 299 diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/operations/_patch.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/operations/_patch.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/models/_patch.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py similarity index 100% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/models/_patch.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_vendor.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_vendor.py similarity index 85% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_vendor.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_vendor.py index fb9f1c76262..db5385d9d54 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/projection/projectedname/aio/_vendor.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/aio/_vendor.py @@ -8,7 +8,7 @@ from abc import ABC from typing import TYPE_CHECKING -from ._configuration import ProjectedNameClientConfiguration +from ._configuration import NotDefinedClientConfiguration if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -17,10 +17,10 @@ from .._serialization import Deserializer, Serializer -class ProjectedNameClientMixinABC(ABC): +class NotDefinedClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "AsyncPipelineClient" - _config: ProjectedNameClientConfiguration + _config: NotDefinedClientConfiguration _serialize: "Serializer" _deserialize: "Deserializer" diff --git a/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/py.typed b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/server/endpoint/notdefined/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/packages/typespec-python/test/unbranded/generated/projection-projected-name/setup.py b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/setup.py similarity index 91% rename from packages/typespec-python/test/unbranded/generated/projection-projected-name/setup.py rename to packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/setup.py index 14b1fec39b8..bc2f60874b5 100644 --- a/packages/typespec-python/test/unbranded/generated/projection-projected-name/setup.py +++ b/packages/typespec-python/test/unbranded/generated/server-endpoint-not-defined/setup.py @@ -12,8 +12,8 @@ from setuptools import setup, find_packages -PACKAGE_NAME = "projection-projectedname" -PACKAGE_PPRINT_NAME = "Projection Projectedname" +PACKAGE_NAME = "server-endpoint-notdefined" +PACKAGE_PPRINT_NAME = "Server Endpoint Notdefined" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace("-", "/") @@ -51,12 +51,13 @@ exclude=[ "tests", # Exclude packages that will be covered by PEP420 or nspkg - "projection", + "server", + "server.endpoint", ] ), include_package_data=True, package_data={ - "projection.projectedname": ["py.typed"], + "server.endpoint.notdefined": ["py.typed"], }, install_requires=[ "isodate>=0.6.1", diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_client.py b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_client.py index 4694f0b3d17..11802e5eef3 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_client.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_client.py @@ -24,7 +24,7 @@ class MultipleClient(MultipleClientOperationsMixin): # pylint: disable=client-a :type endpoint: str :keyword api_version: Pass in v1.0 for API version. Default value is "v1.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str + :paramtype api_version: str or ~server.path.multiple.models.Versions """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential @@ -70,9 +70,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_configuration.py b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_configuration.py index eecc26e3cd0..c23005176b8 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_configuration.py @@ -23,7 +23,7 @@ class MultipleClientConfiguration: # pylint: disable=too-many-instance-attribut :type endpoint: str :keyword api_version: Pass in v1.0 for API version. Default value is "v1.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str + :paramtype api_version: str or ~server.path.multiple.models.Versions """ def __init__(self, endpoint: str, **kwargs: Any) -> None: diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_operations/_operations.py index 6927d49da14..3fe6cf1fa1b 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from .._serialization import Serializer from .._vendor import MultipleClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -77,9 +82,7 @@ def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=inconsi ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -110,7 +113,7 @@ def with_operation_path_param( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -130,9 +133,7 @@ def with_operation_path_param( # pylint: disable=inconsistent-return-statements ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_client.py b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_client.py index 387e2c3d755..73337454f47 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_client.py @@ -24,7 +24,7 @@ class MultipleClient(MultipleClientOperationsMixin): # pylint: disable=client-a :type endpoint: str :keyword api_version: Pass in v1.0 for API version. Default value is "v1.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str + :paramtype api_version: str or ~server.path.multiple.models.Versions """ def __init__( # pylint: disable=missing-client-constructor-parameter-credential @@ -72,9 +72,7 @@ def send_request( request_copy = deepcopy(request) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_configuration.py b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_configuration.py index a4a10a05434..befdd04628b 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_configuration.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_configuration.py @@ -23,7 +23,7 @@ class MultipleClientConfiguration: # pylint: disable=too-many-instance-attribut :type endpoint: str :keyword api_version: Pass in v1.0 for API version. Default value is "v1.0". Note that overriding this default value may result in unsupported behavior. - :paramtype api_version: str + :paramtype api_version: str or ~server.path.multiple.models.Versions """ def __init__(self, endpoint: str, **kwargs: Any) -> None: diff --git a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py index 324dec9a9c7..e98ac3bcddf 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-multiple/server/path/multiple/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ ) from .._vendor import MultipleClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -37,7 +42,7 @@ async def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -56,9 +61,7 @@ async def no_operation_params(self, **kwargs: Any) -> None: # pylint: disable=i ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) @@ -89,7 +92,7 @@ async def with_operation_path_param( # pylint: disable=inconsistent-return-stat :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,9 +112,7 @@ async def with_operation_path_param( # pylint: disable=inconsistent-return-stat ) path_format_arguments = { "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), - "apiVersion": self._serialize.url( - "self._config.api_version", self._config.api_version, "str", skip_quote=True - ), + "apiVersion": self._serialize.url("self._config.api_version", self._config.api_version, "str"), } _request.url = self._client.format_url(_request.url, **path_format_arguments) diff --git a/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/_operations/_operations.py index dd65c2910ff..524f15896dc 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from .._serialization import Serializer from .._vendor import SingleClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +49,7 @@ def my_op(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/aio/_operations/_operations.py index 0d6c6acc02a..9dff84b1d71 100644 --- a/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-path-single/server/path/single/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from ..._operations._operations import build_single_my_op_request from .._vendor import SingleClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +39,7 @@ async def my_op(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py index f09661cbf14..705d0a5d474 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import NotVersionedClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,7 @@ def without_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -119,7 +124,7 @@ def with_query_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +171,7 @@ def with_path_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py index fe194527a1a..aa7477a2ae1 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ ) from .._vendor import NotVersionedClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ async def without_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +89,7 @@ async def with_query_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +136,7 @@ async def with_path_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py index c0f52940e37..75e71625a55 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -23,6 +24,10 @@ from .._serialization import Serializer from .._vendor import VersionedClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ def without_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +122,7 @@ def with_query_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +169,7 @@ def with_path_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py index 0122d608e49..d59bd242264 100644 --- a/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/server-versions-versioned/server/versions/versioned/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ ) from .._vendor import VersionedClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ async def without_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -84,7 +89,7 @@ async def with_query_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +136,7 @@ async def with_path_api_version(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py index e3e106f8ca5..b66c3c843cc 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp import MatchConditions from corehttp.exceptions import ( @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import ConditionalRequestClientMixinABC, prep_if_match, prep_if_none_match +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,7 @@ def post_if_match( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -142,7 +147,7 @@ def post_if_none_match( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py index 483c63ca4df..e5237935547 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp import MatchConditions from corehttp.exceptions import ( @@ -27,6 +28,10 @@ ) from .._vendor import ConditionalRequestClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ async def post_if_match( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +108,7 @@ async def post_if_none_match( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py index 61cf77f45ab..89668ba2693 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/_operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar import uuid from corehttp.exceptions import ( @@ -25,6 +26,10 @@ from .._serialization import Serializer from .._vendor import RepeatabilityClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +62,7 @@ def immediate_success(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py index b0c63c5afbf..dd5f8a53327 100644 --- a/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_operations.py @@ -6,7 +6,8 @@ # Code generated by Unbranded (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -22,6 +23,10 @@ from ..._operations._operations import build_repeatability_immediate_success_request from .._vendor import RepeatabilityClientMixinABC +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +39,7 @@ async def immediate_success(self, **kwargs: Any) -> None: # pylint: disable=inc :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/special-words/specialwords/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-words/specialwords/aio/operations/_operations.py index 78f175a8c2b..237f0151bc9 100644 --- a/packages/typespec-python/test/unbranded/generated/special-words/specialwords/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-words/specialwords/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -230,7 +230,7 @@ async def with_and( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +350,7 @@ async def with_as( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +470,7 @@ async def with_assert( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +590,7 @@ async def with_async( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -710,7 +710,7 @@ async def with_await( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -830,7 +830,7 @@ async def with_break( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -950,7 +950,7 @@ async def with_class( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1070,7 +1070,7 @@ async def with_constructor( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1190,7 +1190,7 @@ async def with_continue( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1310,7 +1310,7 @@ async def with_def( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1430,7 +1430,7 @@ async def with_del( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1550,7 +1550,7 @@ async def with_elif( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1670,7 +1670,7 @@ async def with_else( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1790,7 +1790,7 @@ async def with_except( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1910,7 +1910,7 @@ async def with_exec( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2030,7 +2030,7 @@ async def with_finally( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2150,7 +2150,7 @@ async def with_for( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2270,7 +2270,7 @@ async def with_from( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2390,7 +2390,7 @@ async def with_global( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2510,7 +2510,7 @@ async def with_if( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2630,7 +2630,7 @@ async def with_import( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2750,7 +2750,7 @@ async def with_in( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2870,7 +2870,7 @@ async def with_is( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2990,7 +2990,7 @@ async def with_lambda( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3110,7 +3110,7 @@ async def with_not( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3230,7 +3230,7 @@ async def with_or( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3350,7 +3350,7 @@ async def with_pass( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3470,7 +3470,7 @@ async def with_raise( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3590,7 +3590,7 @@ async def with_return( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3710,7 +3710,7 @@ async def with_try( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3830,7 +3830,7 @@ async def with_while( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3950,7 +3950,7 @@ async def with_with( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4070,7 +4070,7 @@ async def with_yield( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4208,7 +4208,7 @@ async def same_as_model( # pylint: disable=inconsistent-return-statements "SameAsModel": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4278,7 +4278,7 @@ async def and_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4320,7 +4320,7 @@ async def as_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4362,7 +4362,7 @@ async def assert_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4404,7 +4404,7 @@ async def async_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4446,7 +4446,7 @@ async def await_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4488,7 +4488,7 @@ async def break_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4530,7 +4530,7 @@ async def class_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4572,7 +4572,7 @@ async def constructor(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4614,7 +4614,7 @@ async def continue_method(self, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4656,7 +4656,7 @@ async def def_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4698,7 +4698,7 @@ async def del_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4740,7 +4740,7 @@ async def elif_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4782,7 +4782,7 @@ async def else_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4824,7 +4824,7 @@ async def except_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4866,7 +4866,7 @@ async def exec_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4908,7 +4908,7 @@ async def finally_method(self, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4950,7 +4950,7 @@ async def for_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4992,7 +4992,7 @@ async def from_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5034,7 +5034,7 @@ async def global_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5076,7 +5076,7 @@ async def if_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5118,7 +5118,7 @@ async def import_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5160,7 +5160,7 @@ async def in_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5202,7 +5202,7 @@ async def is_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5244,7 +5244,7 @@ async def lambda_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5286,7 +5286,7 @@ async def not_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5328,7 +5328,7 @@ async def or_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5370,7 +5370,7 @@ async def pass_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5412,7 +5412,7 @@ async def raise_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5454,7 +5454,7 @@ async def return_method(self, **kwargs: Any) -> None: # pylint: disable=inconsi :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5496,7 +5496,7 @@ async def try_method(self, **kwargs: Any) -> None: # pylint: disable=inconsiste :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5538,7 +5538,7 @@ async def while_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5580,7 +5580,7 @@ async def with_method(self, **kwargs: Any) -> None: # pylint: disable=inconsist :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5622,7 +5622,7 @@ async def yield_method(self, **kwargs: Any) -> None: # pylint: disable=inconsis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5686,7 +5686,7 @@ async def with_and( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5733,7 +5733,7 @@ async def with_as( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5780,7 +5780,7 @@ async def with_assert( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5827,7 +5827,7 @@ async def with_async( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5874,7 +5874,7 @@ async def with_await( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5921,7 +5921,7 @@ async def with_break( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5968,7 +5968,7 @@ async def with_class( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6015,7 +6015,7 @@ async def with_constructor( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6062,7 +6062,7 @@ async def with_continue( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6109,7 +6109,7 @@ async def with_def( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6156,7 +6156,7 @@ async def with_del( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6203,7 +6203,7 @@ async def with_elif( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6250,7 +6250,7 @@ async def with_else( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6297,7 +6297,7 @@ async def with_except( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6344,7 +6344,7 @@ async def with_exec( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6391,7 +6391,7 @@ async def with_finally( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6438,7 +6438,7 @@ async def with_for( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6485,7 +6485,7 @@ async def with_from( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6532,7 +6532,7 @@ async def with_global( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6579,7 +6579,7 @@ async def with_if( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6626,7 +6626,7 @@ async def with_import( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6673,7 +6673,7 @@ async def with_in( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6720,7 +6720,7 @@ async def with_is( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6767,7 +6767,7 @@ async def with_lambda( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6814,7 +6814,7 @@ async def with_not( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6861,7 +6861,7 @@ async def with_or( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6908,7 +6908,7 @@ async def with_pass( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6955,7 +6955,7 @@ async def with_raise( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7002,7 +7002,7 @@ async def with_return( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7049,7 +7049,7 @@ async def with_try( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7096,7 +7096,7 @@ async def with_while( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7143,7 +7143,7 @@ async def with_with( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7190,7 +7190,7 @@ async def with_yield( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7237,7 +7237,7 @@ async def with_cancellation_token( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/special-words/specialwords/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/special-words/specialwords/operations/_operations.py index 1c90257bb9c..8ba298b0c9c 100644 --- a/packages/typespec-python/test/unbranded/generated/special-words/specialwords/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/special-words/specialwords/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -1250,7 +1250,7 @@ def with_and( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1370,7 +1370,7 @@ def with_as( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1490,7 +1490,7 @@ def with_assert( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1610,7 +1610,7 @@ def with_async( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1730,7 +1730,7 @@ def with_await( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1850,7 +1850,7 @@ def with_break( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1970,7 +1970,7 @@ def with_class( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2090,7 +2090,7 @@ def with_constructor( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2210,7 +2210,7 @@ def with_continue( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2330,7 +2330,7 @@ def with_def( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2450,7 +2450,7 @@ def with_del( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2570,7 +2570,7 @@ def with_elif( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2690,7 +2690,7 @@ def with_else( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2810,7 +2810,7 @@ def with_except( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2930,7 +2930,7 @@ def with_exec( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3050,7 +3050,7 @@ def with_finally( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3170,7 +3170,7 @@ def with_for( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3290,7 +3290,7 @@ def with_from( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3410,7 +3410,7 @@ def with_global( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3530,7 +3530,7 @@ def with_if( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3650,7 +3650,7 @@ def with_import( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3770,7 +3770,7 @@ def with_in( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3890,7 +3890,7 @@ def with_is( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4010,7 +4010,7 @@ def with_lambda( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4130,7 +4130,7 @@ def with_not( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4250,7 +4250,7 @@ def with_or( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4370,7 +4370,7 @@ def with_pass( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4490,7 +4490,7 @@ def with_raise( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4610,7 +4610,7 @@ def with_return( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4730,7 +4730,7 @@ def with_try( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4850,7 +4850,7 @@ def with_while( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4970,7 +4970,7 @@ def with_with( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5090,7 +5090,7 @@ def with_yield( # pylint: disable=inconsistent-return-statements "name": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5228,7 +5228,7 @@ def same_as_model( # pylint: disable=inconsistent-return-statements "SameAsModel": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5298,7 +5298,7 @@ def and_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5340,7 +5340,7 @@ def as_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5382,7 +5382,7 @@ def assert_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5424,7 +5424,7 @@ def async_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5466,7 +5466,7 @@ def await_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5508,7 +5508,7 @@ def break_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5550,7 +5550,7 @@ def class_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5592,7 +5592,7 @@ def constructor(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5634,7 +5634,7 @@ def continue_method(self, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5676,7 +5676,7 @@ def def_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5718,7 +5718,7 @@ def del_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5760,7 +5760,7 @@ def elif_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5802,7 +5802,7 @@ def else_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5844,7 +5844,7 @@ def except_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5886,7 +5886,7 @@ def exec_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5928,7 +5928,7 @@ def finally_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5970,7 +5970,7 @@ def for_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6012,7 +6012,7 @@ def from_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6054,7 +6054,7 @@ def global_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6096,7 +6096,7 @@ def if_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6138,7 +6138,7 @@ def import_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6180,7 +6180,7 @@ def in_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6222,7 +6222,7 @@ def is_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6264,7 +6264,7 @@ def lambda_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6306,7 +6306,7 @@ def not_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6348,7 +6348,7 @@ def or_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6390,7 +6390,7 @@ def pass_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6432,7 +6432,7 @@ def raise_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6474,7 +6474,7 @@ def return_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent- :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6516,7 +6516,7 @@ def try_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-ret :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6558,7 +6558,7 @@ def while_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6600,7 +6600,7 @@ def with_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-re :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6642,7 +6642,7 @@ def yield_method(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-r :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6704,7 +6704,7 @@ def with_and(self, *, and_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6749,7 +6749,7 @@ def with_as(self, *, as_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6796,7 +6796,7 @@ def with_assert( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6843,7 +6843,7 @@ def with_async( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6890,7 +6890,7 @@ def with_await( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6937,7 +6937,7 @@ def with_break( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6984,7 +6984,7 @@ def with_class( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7031,7 +7031,7 @@ def with_constructor( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7078,7 +7078,7 @@ def with_continue( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7123,7 +7123,7 @@ def with_def(self, *, def_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7168,7 +7168,7 @@ def with_del(self, *, del_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7215,7 +7215,7 @@ def with_elif( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7262,7 +7262,7 @@ def with_else( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7309,7 +7309,7 @@ def with_except( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7356,7 +7356,7 @@ def with_exec( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7403,7 +7403,7 @@ def with_finally( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7448,7 +7448,7 @@ def with_for(self, *, for_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7495,7 +7495,7 @@ def with_from( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7542,7 +7542,7 @@ def with_global( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7587,7 +7587,7 @@ def with_if(self, *, if_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7634,7 +7634,7 @@ def with_import( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7679,7 +7679,7 @@ def with_in(self, *, in_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7724,7 +7724,7 @@ def with_is(self, *, is_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7771,7 +7771,7 @@ def with_lambda( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7816,7 +7816,7 @@ def with_not(self, *, not_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7861,7 +7861,7 @@ def with_or(self, *, or_parameter: str, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7908,7 +7908,7 @@ def with_pass( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -7955,7 +7955,7 @@ def with_raise( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8002,7 +8002,7 @@ def with_return( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8047,7 +8047,7 @@ def with_try(self, *, try_parameter: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8094,7 +8094,7 @@ def with_while( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8141,7 +8141,7 @@ def with_with( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8188,7 +8188,7 @@ def with_yield( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -8235,7 +8235,7 @@ def with_cancellation_token( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/aio/operations/_operations.py index 589b73bdf65..e18e7f5ea65 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/aio/operations/_operations.py @@ -9,7 +9,8 @@ import datetime from io import IOBase import json -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -48,6 +49,10 @@ build_unknown_value_put_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ async def get(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,7 +182,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,7 +260,7 @@ async def get(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,7 +353,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -426,7 +431,7 @@ async def get(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,7 +524,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +602,7 @@ async def get(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -690,7 +695,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +773,7 @@ async def get(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -861,7 +866,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -939,7 +944,7 @@ async def get(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1032,7 +1037,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1110,7 +1115,7 @@ async def get(self, **kwargs: Any) -> List[datetime.timedelta]: "1 day, 0:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1203,7 +1208,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1281,7 +1286,7 @@ async def get(self, **kwargs: Any) -> List[Any]: {} # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1374,7 +1379,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1457,7 +1462,7 @@ async def get(self, **kwargs: Any) -> List[_models.InnerModel]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1555,7 +1560,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1633,7 +1638,7 @@ async def get(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1726,7 +1731,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/operations/_operations.py index 2a5a55d7f7b..811033b48cc 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-array/typetest/array/operations/_operations.py @@ -9,7 +9,8 @@ import datetime from io import IOBase import json -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -346,7 +351,7 @@ def get(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -439,7 +444,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,7 +522,7 @@ def get(self, **kwargs: Any) -> List[int]: 0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -610,7 +615,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -688,7 +693,7 @@ def get(self, **kwargs: Any) -> List[bool]: bool # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -781,7 +786,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -859,7 +864,7 @@ def get(self, **kwargs: Any) -> List[str]: "str" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -952,7 +957,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1030,7 +1035,7 @@ def get(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1123,7 +1128,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1201,7 +1206,7 @@ def get(self, **kwargs: Any) -> List[datetime.datetime]: "2020-02-20 00:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1294,7 +1299,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1372,7 +1377,7 @@ def get(self, **kwargs: Any) -> List[datetime.timedelta]: "1 day, 0:00:00" # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1465,7 +1470,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1543,7 +1548,7 @@ def get(self, **kwargs: Any) -> List[Any]: {} # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1636,7 +1641,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1719,7 +1724,7 @@ def get(self, **kwargs: Any) -> List[_models.InnerModel]: } ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1817,7 +1822,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1895,7 +1900,7 @@ def get(self, **kwargs: Any) -> List[float]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1988,7 +1993,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py index 808441f5ffa..2cc831637ab 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/aio/operations/_operations.py @@ -9,7 +9,8 @@ import datetime from io import IOBase import json -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -50,6 +51,10 @@ build_unknown_value_put_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,7 +91,7 @@ async def get(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,7 +184,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,7 +262,7 @@ async def get(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -350,7 +355,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +433,7 @@ async def get(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,7 +526,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -599,7 +604,7 @@ async def get(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -692,7 +697,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -770,7 +775,7 @@ async def get(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -863,7 +868,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -941,7 +946,7 @@ async def get(self, **kwargs: Any) -> Dict[str, datetime.datetime]: "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1034,7 +1039,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1112,7 +1117,7 @@ async def get(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: "str": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1205,7 +1210,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1283,7 +1288,7 @@ async def get(self, **kwargs: Any) -> Dict[str, Any]: "str": {} # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1376,7 +1381,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1459,7 +1464,7 @@ async def get(self, **kwargs: Any) -> Dict[str, _models.InnerModel]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1557,7 +1562,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1640,7 +1645,7 @@ async def get(self, **kwargs: Any) -> Dict[str, _models.InnerModel]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1738,7 +1743,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1816,7 +1821,7 @@ async def get(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1909,7 +1914,7 @@ async def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py index c1098eca506..e29fe1f7169 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-dictionary/typetest/dictionary/operations/_operations.py @@ -9,7 +9,8 @@ import datetime from io import IOBase import json -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -374,7 +379,7 @@ def get(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,7 +472,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -545,7 +550,7 @@ def get(self, **kwargs: Any) -> Dict[str, int]: "str": 0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -638,7 +643,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +721,7 @@ def get(self, **kwargs: Any) -> Dict[str, bool]: "str": bool # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -809,7 +814,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -887,7 +892,7 @@ def get(self, **kwargs: Any) -> Dict[str, str]: "str": "str" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -980,7 +985,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1058,7 +1063,7 @@ def get(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1151,7 +1156,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1229,7 +1234,7 @@ def get(self, **kwargs: Any) -> Dict[str, datetime.datetime]: "str": "2020-02-20 00:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1322,7 +1327,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1400,7 +1405,7 @@ def get(self, **kwargs: Any) -> Dict[str, datetime.timedelta]: "str": "1 day, 0:00:00" # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1493,7 +1498,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1571,7 +1576,7 @@ def get(self, **kwargs: Any) -> Dict[str, Any]: "str": {} # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1664,7 +1669,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1752,7 @@ def get(self, **kwargs: Any) -> Dict[str, _models.InnerModel]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1845,7 +1850,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1928,7 +1933,7 @@ def get(self, **kwargs: Any) -> Dict[str, _models.InnerModel]: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2026,7 +2031,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2104,7 +2109,7 @@ def get(self, **kwargs: Any) -> Dict[str, float]: "str": 0.0 # Optional. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2197,7 +2202,7 @@ def put( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py index 15718112493..73adff10311 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from corehttp.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_string_put_unknown_value_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ async def get_known_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekE :rtype: str or ~typetest.enum.extensible.models.DaysOfWeekExtensibleEnum :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +112,7 @@ async def get_unknown_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWee :rtype: str or ~typetest.enum.extensible.models.DaysOfWeekExtensibleEnum :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +166,7 @@ async def put_known_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +218,7 @@ async def put_unknown_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py index 37e78b476b9..53d1c8ff226 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-extensible/typetest/enum/extensible/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from corehttp.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,13 +68,12 @@ def build_string_get_unknown_value_request(**kwargs: Any) -> HttpRequest: def build_string_put_known_value_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/enum/extensible/string/known-value" # 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) @@ -77,13 +81,12 @@ def build_string_put_known_value_request(**kwargs: Any) -> HttpRequest: def build_string_put_unknown_value_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/enum/extensible/string/unknown-value" # 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) @@ -112,7 +115,7 @@ def get_known_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekExtensi :rtype: str or ~typetest.enum.extensible.models.DaysOfWeekExtensibleEnum :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +164,7 @@ def get_unknown_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekExten :rtype: str or ~typetest.enum.extensible.models.DaysOfWeekExtensibleEnum :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,7 +218,7 @@ def put_known_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +270,7 @@ def put_unknown_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py index 7defba8267e..a99c87df69c 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from corehttp.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ build_string_put_unknown_value_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +62,7 @@ async def get_known_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekE :rtype: str or ~typetest.enum.fixed.models.DaysOfWeekEnum :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +116,7 @@ async def put_known_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -163,7 +168,7 @@ async def put_unknown_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py index 7d8ab88aefc..25c3954e5f9 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-enum-fixed/typetest/enum/fixed/operations/_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import json -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union from corehttp.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,13 +54,12 @@ def build_string_get_known_value_request(**kwargs: Any) -> HttpRequest: def build_string_put_known_value_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/enum/fixed/string/known-value" # 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) @@ -63,13 +67,12 @@ def build_string_put_known_value_request(**kwargs: Any) -> HttpRequest: def build_string_put_unknown_value_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/enum/fixed/string/unknown-value" # 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) @@ -98,7 +101,7 @@ def get_known_value(self, **kwargs: Any) -> Union[str, _models.DaysOfWeekEnum]: :rtype: str or ~typetest.enum.fixed.models.DaysOfWeekEnum :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,7 +155,7 @@ def put_known_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -204,7 +207,7 @@ def put_unknown_value( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py index 8bae8e3434f..293aee5ee5c 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -78,9 +78,9 @@ def build_empty_post_round_trip_empty_request(**kwargs: Any) -> HttpRequest: # _url = "/type/model/empty/round-trip" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -157,7 +157,7 @@ def put_empty( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +209,7 @@ def get_empty(self, **kwargs: Any) -> _models.EmptyOutput: :rtype: ~typetest.model.empty.models.EmptyOutput :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +322,7 @@ def post_round_trip_empty( # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py index 9cda33a67a8..29dc236a914 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-empty/typetest/model/empty/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -113,7 +113,7 @@ async def put_empty( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +165,7 @@ async def get_empty(self, **kwargs: Any) -> _models.EmptyOutput: :rtype: ~typetest.model.empty.models.EmptyOutput :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +278,7 @@ async def post_round_trip_empty( # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py index 481cf3bb6f1..311a15d8b06 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -187,7 +187,7 @@ def get_extensible_model(self, **kwargs: Any) -> _models.Dog: # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,7 +318,7 @@ def put_extensible_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +385,7 @@ def get_extensible_model_missing_discriminator(self, **kwargs: Any) -> _models.D # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +449,7 @@ def get_extensible_model_wrong_discriminator(self, **kwargs: Any) -> _models.Dog # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,7 +513,7 @@ def get_fixed_model(self, **kwargs: Any) -> _models.Snake: # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -644,7 +644,7 @@ def put_fixed_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +711,7 @@ def get_fixed_model_missing_discriminator(self, **kwargs: Any) -> _models.Snake: # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -775,7 +775,7 @@ def get_fixed_model_wrong_discriminator(self, **kwargs: Any) -> _models.Snake: # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py index a3843963756..f658bf58ea3 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -69,7 +69,7 @@ async def get_extensible_model(self, **kwargs: Any) -> _models.Dog: # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,7 +200,7 @@ async def put_extensible_model( # pylint: disable=inconsistent-return-statement # JSON input template you can fill out and use as your body input. input = dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +269,7 @@ async def get_extensible_model_missing_discriminator( # pylint: disable=name-to # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,7 +333,7 @@ async def get_extensible_model_wrong_discriminator(self, **kwargs: Any) -> _mode # response body for status code(s): 200 response == dog """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -397,7 +397,7 @@ async def get_fixed_model(self, **kwargs: Any) -> _models.Snake: # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,7 +528,7 @@ async def put_fixed_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -595,7 +595,7 @@ async def get_fixed_model_missing_discriminator(self, **kwargs: Any) -> _models. # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -659,7 +659,7 @@ async def get_fixed_model_wrong_discriminator(self, **kwargs: Any) -> _models.Sn # response body for status code(s): 200 response == snake """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py index 938f7309fa1..be4cd6ebc4b 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -174,7 +174,7 @@ def get_model(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -343,7 +343,7 @@ def put_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,7 +429,7 @@ def get_recursive_model(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -598,7 +598,7 @@ def put_recursive_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,7 +684,7 @@ def get_missing_discriminator(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -767,7 +767,7 @@ def get_wrong_discriminator(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py index 1d379b3f4e7..14025d928d8 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -86,7 +86,7 @@ async def get_model(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,7 +255,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +341,7 @@ async def get_recursive_model(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +510,7 @@ async def put_recursive_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -596,7 +596,7 @@ async def get_missing_discriminator(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,7 +679,7 @@ async def get_wrong_discriminator(self, **kwargs: Any) -> _models.Fish: # response body for status code(s): 200 response == fish """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_models.py b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_models.py index 0c81124c01b..796c973f3d2 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_models.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_models.py @@ -25,24 +25,24 @@ class Fish(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar age: Required. - :vartype age: int :ivar kind: Required. Default value is None. :vartype kind: str + :ivar age: Required. + :vartype age: int """ __mapping__: Dict[str, _model_base.Model] = {} - age: int = rest_field() - """Required.""" kind: str = rest_discriminator(name="kind") """Required. Default value is None.""" + age: int = rest_field() + """Required.""" @overload def __init__( self, *, - age: int, kind: str, + age: int, ): ... diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py index 8178ff353c2..584eb2c7f99 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -78,9 +78,9 @@ def build_not_discriminated_put_valid_request(**kwargs: Any) -> HttpRequest: # _url = "/type/model/inheritance/not-discriminated/valid" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="PUT", url=_url, headers=_headers, **kwargs) @@ -165,7 +165,7 @@ def post_valid( # pylint: disable=inconsistent-return-statements "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -227,7 +227,7 @@ def get_valid(self, **kwargs: Any) -> _models.Siamese: "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -376,7 +376,7 @@ def put_valid(self, input: Union[_models.Siamese, JSON, IO[bytes]], **kwargs: An "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py index fee79a52355..8f435edbe67 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -121,7 +121,7 @@ async def post_valid( # pylint: disable=inconsistent-return-statements "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -183,7 +183,7 @@ async def get_valid(self, **kwargs: Any) -> _models.Siamese: "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,7 +334,7 @@ async def put_valid(self, input: Union[_models.Siamese, JSON, IO[bytes]], **kwar "smart": bool # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py index ebf40c6e8a9..c4e0ab241a1 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -150,7 +150,7 @@ def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +213,7 @@ def get(self, **kwargs: Any) -> _models.Extension: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py index b3c7a4e7dee..16feb66a42f 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-recursive/typetest/model/recursive/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -119,7 +119,7 @@ async def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +182,7 @@ async def get(self, **kwargs: Any) -> _models.Extension: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py index 5bc34495b3e..c10e1fe828a 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -194,7 +194,7 @@ def get_model(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -375,7 +375,7 @@ def put_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,7 +467,7 @@ def get_recursive_model(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +648,7 @@ def put_recursive_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -740,7 +740,7 @@ def get_missing_discriminator(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -829,7 +829,7 @@ def get_wrong_discriminator(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +893,7 @@ def get_legacy_model(self, **kwargs: Any) -> _models.Dinosaur: # response body for status code(s): 200 response == dinosaur """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py index c3b83f229c7..4a9575bead2 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -93,7 +93,7 @@ async def get_model(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +274,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -366,7 +366,7 @@ async def get_recursive_model(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -547,7 +547,7 @@ async def put_recursive_model( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. input = bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,7 +639,7 @@ async def get_missing_discriminator(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -728,7 +728,7 @@ async def get_wrong_discriminator(self, **kwargs: Any) -> _models.Bird: # response body for status code(s): 200 response == bird """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -792,7 +792,7 @@ async def get_legacy_model(self, **kwargs: Any) -> _models.Dinosaur: # response body for status code(s): 200 response == dinosaur """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_models.py b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_models.py index 60f75055b0f..f74c122b183 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_models.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_models.py @@ -66,24 +66,24 @@ class Dinosaur(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar size: Required. - :vartype size: int :ivar kind: Required. Default value is None. :vartype kind: str + :ivar size: Required. + :vartype size: int """ __mapping__: Dict[str, _model_base.Model] = {} - size: int = rest_field() - """Required.""" kind: str = rest_discriminator(name="kind") """Required. Default value is None.""" + size: int = rest_field() + """Required.""" @overload def __init__( self, *, - size: int, kind: str, + size: int, ): ... diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py index 546e6b4e150..734f9de04a4 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -78,9 +78,9 @@ def build_usage_input_and_output_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/usage/input-output" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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, headers=_headers, **kwargs) @@ -161,7 +161,7 @@ def input( # pylint: disable=inconsistent-return-statements "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +221,7 @@ def output(self, **kwargs: Any) -> _models.OutputRecord: "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +364,7 @@ def input_and_output( "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py index 6c70ef0d7cd..dda03dd9cba 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-usage/typetest/model/usage/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -117,7 +117,7 @@ async def input( # pylint: disable=inconsistent-return-statements "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -177,7 +177,7 @@ async def output(self, **kwargs: Any) -> _models.OutputRecord: "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,7 +320,7 @@ async def input_and_output( "requiredProp": "str" # Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py index 29b4be3f60b..c698e008c51 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -50,9 +50,9 @@ def build_visibility_get_model_request(**kwargs: Any) -> HttpRequest: _url = "/type/model/visibility" # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "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="GET", url=_url, headers=_headers, **kwargs) @@ -289,7 +289,7 @@ def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +430,7 @@ def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes]], **k ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +571,7 @@ def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +711,7 @@ def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -851,7 +851,7 @@ def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -991,7 +991,7 @@ def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py index c98f18ef6fb..839986ba466 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-model-visibility/typetest/model/visibility/aio/_operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -206,7 +206,7 @@ async def get_model( ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,7 +347,7 @@ async def head_model(self, input: Union[_models.VisibilityModel, JSON, IO[bytes] ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -488,7 +488,7 @@ async def put_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -628,7 +628,7 @@ async def patch_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -768,7 +768,7 @@ async def post_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -908,7 +908,7 @@ async def delete_model( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py index 9da75e8c344..f58ac3e4b98 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -98,7 +98,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalProperties "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -217,7 +217,7 @@ async def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +299,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalProperties "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -428,7 +428,7 @@ async def put( # pylint: disable=inconsistent-return-statements "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,7 +517,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalProperties # response body for status code(s): 200 response == extends_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -660,7 +660,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = extends_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -739,7 +739,7 @@ async def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -858,7 +858,7 @@ async def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -939,7 +939,7 @@ async def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalPropertiesDeriv "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1066,7 +1066,7 @@ async def put( # pylint: disable=inconsistent-return-statements "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1155,7 +1155,7 @@ async def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalPropertiesDiscr # response body for status code(s): 200 response == is_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1298,7 +1298,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = is_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1377,7 +1377,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsStringAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1496,7 +1496,7 @@ async def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1575,7 +1575,7 @@ async def get(self, **kwargs: Any) -> _models.IsStringAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1694,7 +1694,7 @@ async def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1773,7 +1773,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsFloatAdditionalProperties: "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1892,7 +1892,7 @@ async def put( # pylint: disable=inconsistent-return-statements "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1971,7 +1971,7 @@ async def get(self, **kwargs: Any) -> _models.IsFloatAdditionalProperties: "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2090,7 +2090,7 @@ async def put( # pylint: disable=inconsistent-return-statements "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2161,7 +2161,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsModelAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.ExtendsModelAdditionalProperties :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2276,7 +2276,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2347,7 +2347,7 @@ async def get(self, **kwargs: Any) -> _models.IsModelAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.IsModelAdditionalProperties :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2462,7 +2462,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2533,7 +2533,7 @@ async def get(self, **kwargs: Any) -> _models.ExtendsModelArrayAdditionalPropert :rtype: ~typetest.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2654,7 +2654,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2725,7 +2725,7 @@ async def get(self, **kwargs: Any) -> _models.IsModelArrayAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.IsModelArrayAdditionalProperties :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2840,7 +2840,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py index b6272ab4eac..f01ed8cd56e 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -464,7 +464,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,7 +583,7 @@ def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -665,7 +665,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalPropertiesDerive "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -794,7 +794,7 @@ def put( # pylint: disable=inconsistent-return-statements "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -883,7 +883,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsUnknownAdditionalPropertiesDiscri # response body for status code(s): 200 response == extends_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1026,7 +1026,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = extends_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1105,7 +1105,7 @@ def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1224,7 +1224,7 @@ def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1305,7 +1305,7 @@ def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalPropertiesDerived: "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1432,7 +1432,7 @@ def put( # pylint: disable=inconsistent-return-statements "age": 0.0 # Optional. The age property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1521,7 +1521,7 @@ def get(self, **kwargs: Any) -> _models.IsUnknownAdditionalPropertiesDiscriminat # response body for status code(s): 200 response == is_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1664,7 +1664,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = is_unknown_additional_properties_discriminated """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1743,7 +1743,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsStringAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1862,7 +1862,7 @@ def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1941,7 +1941,7 @@ def get(self, **kwargs: Any) -> _models.IsStringAdditionalProperties: "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2060,7 +2060,7 @@ def put( # pylint: disable=inconsistent-return-statements "name": "str" # The name property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2139,7 +2139,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsFloatAdditionalProperties: "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2258,7 +2258,7 @@ def put( # pylint: disable=inconsistent-return-statements "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2337,7 +2337,7 @@ def get(self, **kwargs: Any) -> _models.IsFloatAdditionalProperties: "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2456,7 +2456,7 @@ def put( # pylint: disable=inconsistent-return-statements "id": 0.0 # The id property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2527,7 +2527,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsModelAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.ExtendsModelAdditionalProperties :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2642,7 +2642,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2713,7 +2713,7 @@ def get(self, **kwargs: Any) -> _models.IsModelAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.IsModelAdditionalProperties :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2828,7 +2828,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2899,7 +2899,7 @@ def get(self, **kwargs: Any) -> _models.ExtendsModelArrayAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3020,7 +3020,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3091,7 +3091,7 @@ def get(self, **kwargs: Any) -> _models.IsModelArrayAdditionalProperties: :rtype: ~typetest.property.additionalproperties.models.IsModelArrayAdditionalProperties :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3206,7 +3206,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py index 190670223af..32eae668615 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -94,7 +94,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.StringProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -152,7 +152,7 @@ async def get_null(self, **kwargs: Any) -> _models.StringProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +271,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,7 +393,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +472,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.BytesProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -530,7 +530,7 @@ async def get_null(self, **kwargs: Any) -> _models.BytesProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +649,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -771,7 +771,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -850,7 +850,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.DatetimeProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -908,7 +908,7 @@ async def get_null(self, **kwargs: Any) -> _models.DatetimeProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1027,7 +1027,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1149,7 +1149,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1228,7 +1228,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.DurationProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1286,7 +1286,7 @@ async def get_null(self, **kwargs: Any) -> _models.DurationProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1405,7 +1405,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1527,7 +1527,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1608,7 +1608,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.CollectionsByteProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1668,7 +1668,7 @@ async def get_null(self, **kwargs: Any) -> _models.CollectionsByteProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1795,7 +1795,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1925,7 +1925,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2009,7 +2009,7 @@ async def get_non_null(self, **kwargs: Any) -> _models.CollectionsModelProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2072,7 +2072,7 @@ async def get_null(self, **kwargs: Any) -> _models.CollectionsModelProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2203,7 +2203,7 @@ async def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2337,7 +2337,7 @@ async def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py index 24981fc811e..1195fe8f083 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-nullable/typetest/property/nullable/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -408,7 +408,7 @@ def get_non_null(self, **kwargs: Any) -> _models.StringProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -466,7 +466,7 @@ def get_null(self, **kwargs: Any) -> _models.StringProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -585,7 +585,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -707,7 +707,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -786,7 +786,7 @@ def get_non_null(self, **kwargs: Any) -> _models.BytesProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -844,7 +844,7 @@ def get_null(self, **kwargs: Any) -> _models.BytesProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -963,7 +963,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1085,7 +1085,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1164,7 +1164,7 @@ def get_non_null(self, **kwargs: Any) -> _models.DatetimeProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1222,7 +1222,7 @@ def get_null(self, **kwargs: Any) -> _models.DatetimeProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1341,7 +1341,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1463,7 +1463,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1542,7 +1542,7 @@ def get_non_null(self, **kwargs: Any) -> _models.DurationProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1600,7 +1600,7 @@ def get_null(self, **kwargs: Any) -> _models.DurationProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1719,7 +1719,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1841,7 +1841,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1922,7 +1922,7 @@ def get_non_null(self, **kwargs: Any) -> _models.CollectionsByteProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1982,7 +1982,7 @@ def get_null(self, **kwargs: Any) -> _models.CollectionsByteProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2109,7 +2109,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2239,7 +2239,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2323,7 +2323,7 @@ def get_non_null(self, **kwargs: Any) -> _models.CollectionsModelProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2386,7 +2386,7 @@ def get_null(self, **kwargs: Any) -> _models.CollectionsModelProperty: "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2517,7 +2517,7 @@ def patch_non_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2651,7 +2651,7 @@ def patch_null( # pylint: disable=inconsistent-return-statements "requiredProperty": "str" # Required property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py index 3822c3f0d71..a242daa86aa 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -125,7 +125,7 @@ async def get_all(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +182,7 @@ async def get_default(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +299,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +419,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +497,7 @@ async def get_all(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +554,7 @@ async def get_default(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -671,7 +671,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -791,7 +791,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +869,7 @@ async def get_all(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -926,7 +926,7 @@ async def get_default(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1043,7 +1043,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1163,7 +1163,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1241,7 +1241,7 @@ async def get_all(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1298,7 +1298,7 @@ async def get_default(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1415,7 +1415,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1535,7 +1535,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1615,7 +1615,7 @@ async def get_all(self, **kwargs: Any) -> _models.CollectionsByteProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1674,7 +1674,7 @@ async def get_default(self, **kwargs: Any) -> _models.CollectionsByteProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1795,7 +1795,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1919,7 +1919,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2002,7 +2002,7 @@ async def get_all(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2064,7 +2064,7 @@ async def get_default(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2189,7 +2189,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2317,7 +2317,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2395,7 +2395,7 @@ async def get_all(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2452,7 +2452,7 @@ async def get_default(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2569,7 +2569,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2689,7 +2689,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2767,7 +2767,7 @@ async def get_all(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2824,7 +2824,7 @@ async def get_default(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2941,7 +2941,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3061,7 +3061,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3136,10 +3136,10 @@ async def get_all(self, **kwargs: Any) -> _models.FloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3193,10 +3193,10 @@ async def get_default(self, **kwargs: Any) -> _models.FloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3258,7 +3258,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ @@ -3310,10 +3310,10 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3378,7 +3378,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ @@ -3430,10 +3430,10 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3511,7 +3511,7 @@ async def get_all(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3568,7 +3568,7 @@ async def get_default(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3685,7 +3685,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3805,7 +3805,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3869,6 +3869,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get models that will return all properties in the model. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -3881,11 +3882,11 @@ async def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3928,6 +3929,7 @@ async def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: return deserialized # type: ignore async def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get models that will return the default object. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -3940,11 +3942,11 @@ async def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty # response body for status code(s): 200 response == { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3990,6 +3992,7 @@ async def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty async def put_all( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with all properties present. :param body: Required. @@ -4006,8 +4009,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -4046,6 +4049,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements async def put_all( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with all properties present. :param body: Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -4060,11 +4064,11 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4113,6 +4117,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements async def put_default( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with default properties. :param body: Required. @@ -4129,8 +4134,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -4169,6 +4174,7 @@ async def put_default( # pylint: disable=inconsistent-return-statements async def put_default( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with default properties. :param body: Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -4183,11 +4189,11 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4262,10 +4268,11 @@ async def get_all(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4319,10 +4326,11 @@ async def get_default(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4384,7 +4392,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ @@ -4436,10 +4445,11 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4504,7 +4514,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ @@ -4556,10 +4567,11 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4635,10 +4647,11 @@ async def get_all(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4693,10 +4706,11 @@ async def get_default(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4758,7 +4772,8 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ @@ -4811,10 +4826,11 @@ async def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4879,7 +4895,8 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ @@ -4932,10 +4949,11 @@ async def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5015,7 +5033,7 @@ async def get_all(self, **kwargs: Any) -> _models.RequiredAndOptionalProperty: "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5074,7 +5092,7 @@ async def get_required_only(self, **kwargs: Any) -> _models.RequiredAndOptionalP "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5194,7 +5212,7 @@ async def put_all( # pylint: disable=inconsistent-return-statements "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5317,7 +5335,7 @@ async def put_required_only( # pylint: disable=inconsistent-return-statements "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/__init__.py b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/__init__.py index 7c08419f520..0147648adc2 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/__init__.py @@ -20,10 +20,6 @@ from ._models import UnionFloatLiteralProperty from ._models import UnionIntLiteralProperty from ._models import UnionStringLiteralProperty - -from ._enums import UnionFloatLiteralPropertyProperty -from ._enums import UnionIntLiteralPropertyProperty -from ._enums import UnionStringLiteralPropertyProperty from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -43,9 +39,6 @@ "UnionFloatLiteralProperty", "UnionIntLiteralProperty", "UnionStringLiteralProperty", - "UnionFloatLiteralPropertyProperty", - "UnionIntLiteralPropertyProperty", - "UnionStringLiteralPropertyProperty", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/_enums.py b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/_enums.py deleted file mode 100644 index e0e5b324866..00000000000 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/_enums.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Unbranded Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Unbranded (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from corehttp.utils import CaseInsensitiveEnumMeta - - -class UnionFloatLiteralPropertyProperty(float, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionFloatLiteralPropertyProperty.""" - - ENUM_1_2 = 1.2 - ENUM_2_3 = 2.3 - - -class UnionIntLiteralPropertyProperty(int, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionIntLiteralPropertyProperty.""" - - ENUM_1 = 1 - ENUM_2 = 2 - - -class UnionStringLiteralPropertyProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionStringLiteralPropertyProperty.""" - - HELLO = "hello" - WORLD = "world" diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/_models.py b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/_models.py index 4702eca6015..61c31e0bf08 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/_models.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/models/_models.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload +from typing import Any, List, Literal, Mapping, Optional, TYPE_CHECKING, overload from .. import _model_base from .._model_base import rest_field @@ -196,12 +196,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class FloatLiteralProperty(_model_base.Model): """Model with float literal property. - :ivar property: Property. Default value is 1.2. + :ivar property: Property. Default value is 1.25. :vartype property: float """ property: Optional[float] = rest_field() - """Property. Default value is 1.2.""" + """Property. Default value is 1.25.""" @overload def __init__( @@ -349,21 +349,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class UnionFloatLiteralProperty(_model_base.Model): """Model with union of float literal property. - :ivar property: Property. Known values are: 1.2 and 2.3. - :vartype property: float or - ~typetest.property.optional.models.UnionFloatLiteralPropertyProperty + :ivar property: Property. Is either a float type or a float type. + :vartype property: float or float """ - property: Optional[Union[float, "_models.UnionFloatLiteralPropertyProperty"]] = rest_field() - """Property. Known values are: 1.2 and 2.3.""" + property: Optional[float] = rest_field() + """Property. Is either a float type or a float type.""" @overload def __init__( self, *, - property: Optional[ - Union[float, "_models.UnionFloatLiteralPropertyProperty"] - ] = None, # pylint: disable=redefined-builtin + property: Optional[float] = None, # pylint: disable=redefined-builtin ): ... @@ -381,20 +378,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class UnionIntLiteralProperty(_model_base.Model): """Model with union of int literal property. - :ivar property: Property. Known values are: 1 and 2. - :vartype property: int or ~typetest.property.optional.models.UnionIntLiteralPropertyProperty + :ivar property: Property. Is either a Literal[1] type or a Literal[2] type. + :vartype property: int or int """ - property: Optional[Union[int, "_models.UnionIntLiteralPropertyProperty"]] = rest_field() - """Property. Known values are: 1 and 2.""" + property: Optional[Literal[1, 2]] = rest_field() + """Property. Is either a Literal[1] type or a Literal[2] type.""" @overload def __init__( self, *, - property: Optional[ - Union[int, "_models.UnionIntLiteralPropertyProperty"] - ] = None, # pylint: disable=redefined-builtin + property: Optional[Literal[1, 2]] = None, # pylint: disable=redefined-builtin ): ... @@ -412,20 +407,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class UnionStringLiteralProperty(_model_base.Model): """Model with union of string literal property. - :ivar property: Property. Known values are: "hello" and "world". - :vartype property: str or ~typetest.property.optional.models.UnionStringLiteralPropertyProperty + :ivar property: Property. Is either a Literal["hello"] type or a Literal["world"] type. + :vartype property: str or str """ - property: Optional[Union[str, "_models.UnionStringLiteralPropertyProperty"]] = rest_field() - """Property. Known values are: \"hello\" and \"world\".""" + property: Optional[Literal["hello", "world"]] = rest_field() + """Property. Is either a Literal[\"hello\"] type or a Literal[\"world\"] type.""" @overload def __init__( self, *, - property: Optional[ - Union[str, "_models.UnionStringLiteralPropertyProperty"] - ] = None, # pylint: disable=redefined-builtin + property: Optional[Literal["hello", "world"]] = None, # pylint: disable=redefined-builtin ): ... diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py index 13f0b779a33..1390d8f6057 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-optional/typetest/property/optional/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -859,7 +859,7 @@ def get_all(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -916,7 +916,7 @@ def get_default(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1033,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1153,7 +1153,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": "str" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1231,7 +1231,7 @@ def get_all(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1288,7 +1288,7 @@ def get_default(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1405,7 +1405,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1525,7 +1525,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1603,7 +1603,7 @@ def get_all(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1660,7 +1660,7 @@ def get_default(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1777,7 +1777,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1897,7 +1897,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1975,7 +1975,7 @@ def get_all(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2032,7 +2032,7 @@ def get_default(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2149,7 +2149,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2269,7 +2269,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Optional. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2349,7 +2349,7 @@ def get_all(self, **kwargs: Any) -> _models.CollectionsByteProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2408,7 +2408,7 @@ def get_default(self, **kwargs: Any) -> _models.CollectionsByteProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2529,7 +2529,7 @@ def put_all( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2653,7 +2653,7 @@ def put_default( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2736,7 +2736,7 @@ def get_all(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2798,7 +2798,7 @@ def get_default(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2923,7 +2923,7 @@ def put_all( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3051,7 +3051,7 @@ def put_default( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3129,7 +3129,7 @@ def get_all(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3186,7 +3186,7 @@ def get_default(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3303,7 +3303,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3423,7 +3423,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": "hello" # Optional. Default value is "hello". Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3501,7 +3501,7 @@ def get_all(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3558,7 +3558,7 @@ def get_default(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3675,7 +3675,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3795,7 +3795,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": 1 # Optional. Default value is 1. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3870,10 +3870,10 @@ def get_all(self, **kwargs: Any) -> _models.FloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3927,10 +3927,10 @@ def get_default(self, **kwargs: Any) -> _models.FloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3992,7 +3992,7 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ @@ -4044,10 +4044,10 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4112,7 +4112,7 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ @@ -4164,10 +4164,10 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 1.2 # Optional. Default value is 1.2. Property. + "property": 1.25 # Optional. Default value is 1.25. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4245,7 +4245,7 @@ def get_all(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4302,7 +4302,7 @@ def get_default(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4419,7 +4419,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4539,7 +4539,7 @@ def put_default( # pylint: disable=inconsistent-return-statements "property": True # Optional. Default value is True. Property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4603,6 +4603,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get models that will return all properties in the model. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -4615,11 +4616,11 @@ def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4662,6 +4663,7 @@ def get_all(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: return deserialized # type: ignore def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get models that will return the default object. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -4674,11 +4676,11 @@ def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4724,6 +4726,7 @@ def get_default(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: def put_all( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with all properties present. :param body: Required. @@ -4740,8 +4743,8 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -4780,6 +4783,7 @@ def put_all( # pylint: disable=inconsistent-return-statements def put_all( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with all properties present. :param body: Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -4794,11 +4798,11 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4847,6 +4851,7 @@ def put_all( # pylint: disable=inconsistent-return-statements def put_default( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with default properties. :param body: Required. @@ -4863,8 +4868,8 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -4903,6 +4908,7 @@ def put_default( # pylint: disable=inconsistent-return-statements def put_default( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put a body with default properties. :param body: Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -4917,11 +4923,11 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Optional. Property. Known values are: "hello" and - "world". + "property": "hello" # Optional. Default value is "hello". Property. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4996,10 +5002,11 @@ def get_all(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5053,10 +5060,11 @@ def get_default(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5118,7 +5126,8 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ @@ -5170,10 +5179,11 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5238,7 +5248,8 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ @@ -5290,10 +5301,11 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Optional. Property. Known values are: 1 and 2. + "property": 1 # Optional. Default value is 1. Property. Is either a + Literal[1] type or a Literal[2] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5369,10 +5381,11 @@ def get_all(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5427,10 +5440,11 @@ def get_default(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5492,7 +5506,8 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ @@ -5545,10 +5560,11 @@ def put_all( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5613,7 +5629,8 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ @@ -5666,10 +5683,11 @@ def put_default( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Optional. Property. Known values are: 1.2 and 2.3. + "property": 1.25 # Optional. Default value is 1.25. Property. Is either a + float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5749,7 +5767,7 @@ def get_all(self, **kwargs: Any) -> _models.RequiredAndOptionalProperty: "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5808,7 +5826,7 @@ def get_required_only(self, **kwargs: Any) -> _models.RequiredAndOptionalPropert "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5928,7 +5946,7 @@ def put_all( # pylint: disable=inconsistent-return-statements "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6051,7 +6069,7 @@ def put_required_only( # pylint: disable=inconsistent-return-statements "optionalProperty": "str" # Optional. optional string property. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/_client.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/_client.py index 6ff425ff697..faadfac3de8 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/_client.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/_client.py @@ -36,6 +36,7 @@ NeverOperations, StringLiteralOperations, StringOperations, + UnionEnumValueOperations, UnionFloatLiteralOperations, UnionIntLiteralOperations, UnionStringLiteralOperations, @@ -108,6 +109,8 @@ class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,to :ivar union_float_literal: UnionFloatLiteralOperations operations :vartype union_float_literal: typetest.property.valuetypes.operations.UnionFloatLiteralOperations + :ivar union_enum_value: UnionEnumValueOperations operations + :vartype union_enum_value: typetest.property.valuetypes.operations.UnionEnumValueOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -172,6 +175,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.union_float_literal = UnionFloatLiteralOperations( self._client, self._config, self._serialize, self._deserialize ) + self.union_enum_value = UnionEnumValueOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py index 192a41b4b8b..a62a9deee4e 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py @@ -36,6 +36,7 @@ NeverOperations, StringLiteralOperations, StringOperations, + UnionEnumValueOperations, UnionFloatLiteralOperations, UnionIntLiteralOperations, UnionStringLiteralOperations, @@ -111,6 +112,8 @@ class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,to :ivar union_float_literal: UnionFloatLiteralOperations operations :vartype union_float_literal: typetest.property.valuetypes.aio.operations.UnionFloatLiteralOperations + :ivar union_enum_value: UnionEnumValueOperations operations + :vartype union_enum_value: typetest.property.valuetypes.aio.operations.UnionEnumValueOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -175,6 +178,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.union_float_literal = UnionFloatLiteralOperations( self._client, self._config, self._serialize, self._deserialize ) + self.union_enum_value = UnionEnumValueOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/__init__.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/__init__.py index edd5ef46bb2..c7896a7e96e 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/__init__.py @@ -34,6 +34,7 @@ from ._operations import UnionStringLiteralOperations from ._operations import UnionIntLiteralOperations from ._operations import UnionFloatLiteralOperations +from ._operations import UnionEnumValueOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -68,6 +69,7 @@ "UnionStringLiteralOperations", "UnionIntLiteralOperations", "UnionFloatLiteralOperations", + "UnionEnumValueOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py index ca3c05a52d5..2194022f6bc 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -68,6 +68,8 @@ build_string_literal_get_request, build_string_literal_put_request, build_string_put_request, + build_union_enum_value_get_request, + build_union_enum_value_put_request, build_union_float_literal_get_request, build_union_float_literal_put_request, build_union_int_literal_get_request, @@ -125,7 +127,7 @@ async def get(self, **kwargs: Any) -> _models.BooleanProperty: "property": bool # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,7 +244,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": bool # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -320,7 +322,7 @@ async def get(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +439,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": "str" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +517,7 @@ async def get(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -632,7 +634,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -710,7 +712,7 @@ async def get(self, **kwargs: Any) -> _models.IntProperty: "property": 0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -827,7 +829,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -905,7 +907,7 @@ async def get(self, **kwargs: Any) -> _models.FloatProperty: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1022,7 +1024,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1100,7 +1102,7 @@ async def get(self, **kwargs: Any) -> _models.DecimalProperty: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1217,7 +1219,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1295,7 +1297,7 @@ async def get(self, **kwargs: Any) -> _models.Decimal128Property: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1412,7 +1414,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1490,7 +1492,7 @@ async def get(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1607,7 +1609,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1685,7 +1687,7 @@ async def get(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1802,7 +1804,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1881,7 +1883,7 @@ async def get(self, **kwargs: Any) -> _models.EnumProperty: "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2000,7 +2002,7 @@ async def put( # pylint: disable=inconsistent-return-statements "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2079,7 +2081,7 @@ async def get(self, **kwargs: Any) -> _models.ExtensibleEnumProperty: "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2199,7 +2201,7 @@ async def put( # pylint: disable=inconsistent-return-statements "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2279,7 +2281,7 @@ async def get(self, **kwargs: Any) -> _models.ModelProperty: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2400,7 +2402,7 @@ async def put( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2481,7 +2483,7 @@ async def get(self, **kwargs: Any) -> _models.CollectionsStringProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2603,7 +2605,7 @@ async def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2683,7 +2685,7 @@ async def get(self, **kwargs: Any) -> _models.CollectionsIntProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2805,7 +2807,7 @@ async def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2888,7 +2890,7 @@ async def get(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3014,7 +3016,7 @@ async def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3095,7 +3097,7 @@ async def get(self, **kwargs: Any) -> _models.DictionaryStringProperty: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3217,7 +3219,7 @@ async def put( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3287,7 +3289,7 @@ async def get(self, **kwargs: Any) -> _models.NeverProperty: :rtype: ~typetest.property.valuetypes.models.NeverProperty :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3400,7 +3402,7 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3478,7 +3480,7 @@ async def get(self, **kwargs: Any) -> _models.UnknownStringProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3596,7 +3598,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3674,7 +3676,7 @@ async def get(self, **kwargs: Any) -> _models.UnknownIntProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3791,7 +3793,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3869,7 +3871,7 @@ async def get(self, **kwargs: Any) -> _models.UnknownDictProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3987,7 +3989,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4065,7 +4067,7 @@ async def get(self, **kwargs: Any) -> _models.UnknownArrayProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4183,7 +4185,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4261,7 +4263,7 @@ async def get(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Default value is "hello". Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4379,7 +4381,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": "hello" # Default value is "hello". Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4457,7 +4459,7 @@ async def get(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 42 # Default value is 42. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4574,7 +4576,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 42 # Default value is 42. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4652,7 +4654,7 @@ async def get(self, **kwargs: Any) -> _models.FloatLiteralProperty: "property": 43.125 # Default value is 43.125. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4770,7 +4772,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": 43.125 # Default value is 43.125. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4848,7 +4850,7 @@ async def get(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Default value is True. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4966,7 +4968,7 @@ async def put( # pylint: disable=inconsistent-return-statements "property": True # Default value is True. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5030,6 +5032,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get call. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -5042,11 +5045,11 @@ async def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5092,6 +5095,7 @@ async def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: async def put( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put operation. :param body: body. Required. @@ -5108,8 +5112,8 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -5148,6 +5152,7 @@ async def put( # pylint: disable=inconsistent-return-statements async def put( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put operation. :param body: body. Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -5163,11 +5168,11 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5242,10 +5247,11 @@ async def get(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5307,7 +5313,8 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ @@ -5360,10 +5367,11 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5439,10 +5447,11 @@ async def get(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5504,7 +5513,8 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ @@ -5557,10 +5567,11 @@ async def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5604,3 +5615,199 @@ async def put( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore + + +class UnionEnumValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~typetest.property.valuetypes.aio.ValueTypesClient`'s + :attr:`union_enum_value` attribute. + """ + + 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") + + async def get(self, **kwargs: Any) -> _models.UnionEnumValueProperty: + """Get call. + + :return: UnionEnumValueProperty. The UnionEnumValueProperty is compatible with MutableMapping + :rtype: ~typetest.property.valuetypes.models.UnionEnumValueProperty + :raises ~corehttp.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "property": "str" # Property. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.UnionEnumValueProperty] = kwargs.pop("cls", None) + + _request = build_union_enum_value_get_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.UnionEnumValueProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def put( # pylint: disable=inconsistent-return-statements + self, body: _models.UnionEnumValueProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: ~typetest.property.valuetypes.models.UnionEnumValueProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "property": "str" # Property. Required. + } + """ + + @overload + async def put( # pylint: disable=inconsistent-return-statements + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + async def put( # pylint: disable=inconsistent-return-statements + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + async def put( # pylint: disable=inconsistent-return-statements + self, body: Union[_models.UnionEnumValueProperty, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Is one of the following types: UnionEnumValueProperty, JSON, IO[bytes] + Required. + :type body: ~typetest.property.valuetypes.models.UnionEnumValueProperty or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "property": "str" # Property. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_value_put_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/__init__.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/__init__.py index 2b784d1738f..cc92ff6f05f 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/__init__.py @@ -28,6 +28,7 @@ from ._models import NeverProperty from ._models import StringLiteralProperty from ._models import StringProperty +from ._models import UnionEnumValueProperty from ._models import UnionFloatLiteralProperty from ._models import UnionIntLiteralProperty from ._models import UnionStringLiteralProperty @@ -36,11 +37,9 @@ from ._models import UnknownIntProperty from ._models import UnknownStringProperty +from ._enums import ExtendedEnum from ._enums import FixedInnerEnum from ._enums import InnerEnum -from ._enums import UnionFloatLiteralPropertyProperty -from ._enums import UnionIntLiteralPropertyProperty -from ._enums import UnionStringLiteralPropertyProperty from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -68,6 +67,7 @@ "NeverProperty", "StringLiteralProperty", "StringProperty", + "UnionEnumValueProperty", "UnionFloatLiteralProperty", "UnionIntLiteralProperty", "UnionStringLiteralProperty", @@ -75,11 +75,9 @@ "UnknownDictProperty", "UnknownIntProperty", "UnknownStringProperty", + "ExtendedEnum", "FixedInnerEnum", "InnerEnum", - "UnionFloatLiteralPropertyProperty", - "UnionIntLiteralPropertyProperty", - "UnionStringLiteralPropertyProperty", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_enums.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_enums.py index 77516ed476e..bb97f60f39d 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_enums.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_enums.py @@ -10,6 +10,12 @@ from corehttp.utils import CaseInsensitiveEnumMeta +class ExtendedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ExtendedEnum.""" + + ENUM_VALUE2 = "value2" + + class FixedInnerEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum that will be used as a property for model EnumProperty. Non-extensible.""" @@ -26,24 +32,3 @@ class InnerEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """First value.""" VALUE_TWO = "ValueTwo" """Second value.""" - - -class UnionFloatLiteralPropertyProperty(float, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionFloatLiteralPropertyProperty.""" - - ENUM_43_125 = 43.125 - ENUM_46_875 = 46.875 - - -class UnionIntLiteralPropertyProperty(int, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionIntLiteralPropertyProperty.""" - - ENUM_42 = 42 - ENUM_43 = 43 - - -class UnionStringLiteralPropertyProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of UnionStringLiteralPropertyProperty.""" - - HELLO = "hello" - WORLD = "world" diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_models.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_models.py index c9a1f9aa90b..5170cd18ded 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_models.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/models/_models.py @@ -13,6 +13,7 @@ from .. import _model_base from .._model_base import rest_field +from ._enums import ExtendedEnum if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -626,24 +627,55 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles super().__init__(*args, **kwargs) +class UnionEnumValueProperty(_model_base.Model): + """Template type for testing models with specific properties. Pass in the type of the property you + are looking for. + + All required parameters must be populated in order to send to server. + + :ivar property: Property. Required. + :vartype property: str or ~typetest.property.valuetypes.models.ENUM_VALUE2 + """ + + property: Literal[ExtendedEnum.ENUM_VALUE2] = rest_field() + """Property. Required.""" + + @overload + def __init__( + self, + *, + property: Literal[ExtendedEnum.ENUM_VALUE2], # pylint: disable=redefined-builtin + ): + ... + + @overload + def __init__(self, mapping: Mapping[str, Any]): + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + super().__init__(*args, **kwargs) + + class UnionFloatLiteralProperty(_model_base.Model): """Model with a union of float literal as property. All required parameters must be populated in order to send to server. - :ivar property: Property. Required. Known values are: 43.125 and 46.875. - :vartype property: float or - ~typetest.property.valuetypes.models.UnionFloatLiteralPropertyProperty + :ivar property: Property. Required. Is either a float type or a float type. + :vartype property: float or float """ - property: Union[float, "_models.UnionFloatLiteralPropertyProperty"] = rest_field() - """Property. Required. Known values are: 43.125 and 46.875.""" + property: float = rest_field() + """Property. Required. Is either a float type or a float type.""" @overload def __init__( self, *, - property: Union[float, "_models.UnionFloatLiteralPropertyProperty"], # pylint: disable=redefined-builtin + property: float, # pylint: disable=redefined-builtin ): ... @@ -663,18 +695,18 @@ class UnionIntLiteralProperty(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar property: Property. Required. Known values are: 42 and 43. - :vartype property: int or ~typetest.property.valuetypes.models.UnionIntLiteralPropertyProperty + :ivar property: Property. Required. Is either a Literal[42] type or a Literal[43] type. + :vartype property: int or int """ - property: Union[int, "_models.UnionIntLiteralPropertyProperty"] = rest_field() - """Property. Required. Known values are: 42 and 43.""" + property: Literal[42, 43] = rest_field() + """Property. Required. Is either a Literal[42] type or a Literal[43] type.""" @overload def __init__( self, *, - property: Union[int, "_models.UnionIntLiteralPropertyProperty"], # pylint: disable=redefined-builtin + property: Literal[42, 43], # pylint: disable=redefined-builtin ): ... @@ -694,19 +726,19 @@ class UnionStringLiteralProperty(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar property: Property. Required. Known values are: "hello" and "world". - :vartype property: str or - ~typetest.property.valuetypes.models.UnionStringLiteralPropertyProperty + :ivar property: Property. Required. Is either a Literal["hello"] type or a Literal["world"] + type. + :vartype property: str or str """ - property: Union[str, "_models.UnionStringLiteralPropertyProperty"] = rest_field() - """Property. Required. Known values are: \"hello\" and \"world\".""" + property: Literal["hello", "world"] = rest_field() + """Property. Required. Is either a Literal[\"hello\"] type or a Literal[\"world\"] type.""" @overload def __init__( self, *, - property: Union[str, "_models.UnionStringLiteralPropertyProperty"], # pylint: disable=redefined-builtin + property: Literal["hello", "world"], # pylint: disable=redefined-builtin ): ... diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/__init__.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/__init__.py index edd5ef46bb2..c7896a7e96e 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/__init__.py @@ -34,6 +34,7 @@ from ._operations import UnionStringLiteralOperations from ._operations import UnionIntLiteralOperations from ._operations import UnionFloatLiteralOperations +from ._operations import UnionEnumValueOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -68,6 +69,7 @@ "UnionStringLiteralOperations", "UnionIntLiteralOperations", "UnionFloatLiteralOperations", + "UnionEnumValueOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py index 089f851cd57..7c46c28a928 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-property-valuetypes/typetest/property/valuetypes/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -823,6 +823,34 @@ def build_union_float_literal_put_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) +def build_union_enum_value_get_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/type/property/value-types/union-enum-value" + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs) + + +def build_union_enum_value_put_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + # Construct URL + _url = "/type/property/value-types/union-enum-value" + + # 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) + + class BooleanOperations: """ .. warning:: @@ -855,7 +883,7 @@ def get(self, **kwargs: Any) -> _models.BooleanProperty: "property": bool # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -972,7 +1000,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": bool # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1050,7 +1078,7 @@ def get(self, **kwargs: Any) -> _models.StringProperty: "property": "str" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1167,7 +1195,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": "str" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1245,7 +1273,7 @@ def get(self, **kwargs: Any) -> _models.BytesProperty: "property": bytes("bytes", encoding="utf-8") # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1362,7 +1390,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": bytes("bytes", encoding="utf-8") # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1440,7 +1468,7 @@ def get(self, **kwargs: Any) -> _models.IntProperty: "property": 0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1557,7 +1585,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1635,7 +1663,7 @@ def get(self, **kwargs: Any) -> _models.FloatProperty: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1752,7 +1780,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1830,7 +1858,7 @@ def get(self, **kwargs: Any) -> _models.DecimalProperty: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1947,7 +1975,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2025,7 +2053,7 @@ def get(self, **kwargs: Any) -> _models.Decimal128Property: "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2142,7 +2170,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 0.0 # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2220,7 +2248,7 @@ def get(self, **kwargs: Any) -> _models.DatetimeProperty: "property": "2020-02-20 00:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2337,7 +2365,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": "2020-02-20 00:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2415,7 +2443,7 @@ def get(self, **kwargs: Any) -> _models.DurationProperty: "property": "1 day, 0:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2532,7 +2560,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": "1 day, 0:00:00" # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2611,7 +2639,7 @@ def get(self, **kwargs: Any) -> _models.EnumProperty: "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2730,7 +2758,7 @@ def put( # pylint: disable=inconsistent-return-statements "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2809,7 +2837,7 @@ def get(self, **kwargs: Any) -> _models.ExtensibleEnumProperty: "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2929,7 +2957,7 @@ def put( # pylint: disable=inconsistent-return-statements "ValueTwo". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3009,7 +3037,7 @@ def get(self, **kwargs: Any) -> _models.ModelProperty: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3130,7 +3158,7 @@ def put( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3211,7 +3239,7 @@ def get(self, **kwargs: Any) -> _models.CollectionsStringProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3333,7 +3361,7 @@ def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3413,7 +3441,7 @@ def get(self, **kwargs: Any) -> _models.CollectionsIntProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3535,7 +3563,7 @@ def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3618,7 +3646,7 @@ def get(self, **kwargs: Any) -> _models.CollectionsModelProperty: ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3744,7 +3772,7 @@ def put( # pylint: disable=inconsistent-return-statements ] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3825,7 +3853,7 @@ def get(self, **kwargs: Any) -> _models.DictionaryStringProperty: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3947,7 +3975,7 @@ def put( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4017,7 +4045,7 @@ def get(self, **kwargs: Any) -> _models.NeverProperty: :rtype: ~typetest.property.valuetypes.models.NeverProperty :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4130,7 +4158,7 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = {} """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4208,7 +4236,7 @@ def get(self, **kwargs: Any) -> _models.UnknownStringProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4326,7 +4354,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4404,7 +4432,7 @@ def get(self, **kwargs: Any) -> _models.UnknownIntProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4521,7 +4549,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4599,7 +4627,7 @@ def get(self, **kwargs: Any) -> _models.UnknownDictProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4717,7 +4745,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4795,7 +4823,7 @@ def get(self, **kwargs: Any) -> _models.UnknownArrayProperty: "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4913,7 +4941,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": {} # Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4991,7 +5019,7 @@ def get(self, **kwargs: Any) -> _models.StringLiteralProperty: "property": "hello" # Default value is "hello". Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5109,7 +5137,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": "hello" # Default value is "hello". Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5187,7 +5215,7 @@ def get(self, **kwargs: Any) -> _models.IntLiteralProperty: "property": 42 # Default value is 42. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5304,7 +5332,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 42 # Default value is 42. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5382,7 +5410,7 @@ def get(self, **kwargs: Any) -> _models.FloatLiteralProperty: "property": 43.125 # Default value is 43.125. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5500,7 +5528,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": 43.125 # Default value is 43.125. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5578,7 +5606,7 @@ def get(self, **kwargs: Any) -> _models.BooleanLiteralProperty: "property": True # Default value is True. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5696,7 +5724,7 @@ def put( # pylint: disable=inconsistent-return-statements "property": True # Default value is True. Property. Required. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5760,6 +5788,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: + # pylint: disable=line-too-long """Get call. :return: UnionStringLiteralProperty. The UnionStringLiteralProperty is compatible with @@ -5772,11 +5801,11 @@ def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: # response body for status code(s): 200 response == { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5822,6 +5851,7 @@ def get(self, **kwargs: Any) -> _models.UnionStringLiteralProperty: def put( # pylint: disable=inconsistent-return-statements self, body: _models.UnionStringLiteralProperty, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put operation. :param body: body. Required. @@ -5838,8 +5868,8 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ @@ -5878,6 +5908,7 @@ def put( # pylint: disable=inconsistent-return-statements def put( # pylint: disable=inconsistent-return-statements self, body: Union[_models.UnionStringLiteralProperty, JSON, IO[bytes]], **kwargs: Any ) -> None: + # pylint: disable=line-too-long """Put operation. :param body: body. Is one of the following types: UnionStringLiteralProperty, JSON, IO[bytes] @@ -5893,11 +5924,11 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": "str" # Property. Required. Known values are: "hello" and - "world". + "property": "hello" # Default value is "hello". Property. Required. Is + either a Literal["hello"] type or a Literal["world"] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5972,10 +6003,11 @@ def get(self, **kwargs: Any) -> _models.UnionIntLiteralProperty: # response body for status code(s): 200 response == { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6037,7 +6069,8 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ @@ -6090,10 +6123,11 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0 # Property. Required. Known values are: 42 and 43. + "property": 42 # Default value is 42. Property. Required. Is either a + Literal[42] type or a Literal[43] type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6169,10 +6203,11 @@ def get(self, **kwargs: Any) -> _models.UnionFloatLiteralProperty: # response body for status code(s): 200 response == { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6234,7 +6269,8 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ @@ -6287,10 +6323,11 @@ def put( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "property": 0.0 # Property. Required. Known values are: 43.125 and 46.875. + "property": 43.125 # Default value is 43.125. Property. Required. Is either + a float type or a float type. } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6334,3 +6371,199 @@ def put( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore + + +class UnionEnumValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~typetest.property.valuetypes.ValueTypesClient`'s + :attr:`union_enum_value` attribute. + """ + + 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") + + def get(self, **kwargs: Any) -> _models.UnionEnumValueProperty: + """Get call. + + :return: UnionEnumValueProperty. The UnionEnumValueProperty is compatible with MutableMapping + :rtype: ~typetest.property.valuetypes.models.UnionEnumValueProperty + :raises ~corehttp.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "property": "str" # Property. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.UnionEnumValueProperty] = kwargs.pop("cls", None) + + _request = build_union_enum_value_get_request( + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.UnionEnumValueProperty, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def put( # pylint: disable=inconsistent-return-statements + self, body: _models.UnionEnumValueProperty, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: ~typetest.property.valuetypes.models.UnionEnumValueProperty + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "property": "str" # Property. Required. + } + """ + + @overload + def put( # pylint: disable=inconsistent-return-statements + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + @overload + def put( # pylint: disable=inconsistent-return-statements + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + """ + + def put( # pylint: disable=inconsistent-return-statements + self, body: Union[_models.UnionEnumValueProperty, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Put operation. + + :param body: body. Is one of the following types: UnionEnumValueProperty, JSON, IO[bytes] + Required. + :type body: ~typetest.property.valuetypes.models.UnionEnumValueProperty or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~corehttp.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # JSON input template you can fill out and use as your body input. + body = { + "property": "str" # Property. Required. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_union_enum_value_put_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client.pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py index 5401a155682..1e9336c17d5 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/aio/operations/_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import decimal import json -from typing import Any, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -42,6 +43,10 @@ build_unknown_put_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,7 @@ async def get(self, **kwargs: Any) -> str: :rtype: str :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +126,7 @@ async def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +191,7 @@ async def get(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +242,7 @@ async def put(self, body: bool, **kwargs: Any) -> None: # pylint: disable=incon :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +307,7 @@ async def get(self, **kwargs: Any) -> Any: :rtype: any :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,7 +358,7 @@ async def put(self, body: Any, **kwargs: Any) -> None: # pylint: disable=incons :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +423,7 @@ async def response_body(self, **kwargs: Any) -> decimal.Decimal: :rtype: ~decimal.Decimal :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -471,7 +476,7 @@ async def request_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -522,7 +527,7 @@ async def request_parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -583,7 +588,7 @@ async def response_body(self, **kwargs: Any) -> decimal.Decimal: :rtype: ~decimal.Decimal :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -636,7 +641,7 @@ async def request_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -687,7 +692,7 @@ async def request_parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -756,7 +761,7 @@ async def prepare_verify(self, **kwargs: Any) -> List[decimal.Decimal]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -809,7 +814,7 @@ async def verify( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -882,7 +887,7 @@ async def prepare_verify(self, **kwargs: Any) -> List[decimal.Decimal]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -935,7 +940,7 @@ async def verify( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/operations/_operations.py index 9b427a52b27..d3d84bf60c7 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-scalar/typetest/scalar/operations/_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- import decimal import json -from typing import Any, Callable, Dict, List, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Optional, Type, TypeVar from corehttp.exceptions import ( ClientAuthenticationError, @@ -25,6 +26,10 @@ from .._model_base import SdkJSONEncoder, _deserialize 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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,13 +54,12 @@ def build_string_get_request(**kwargs: Any) -> HttpRequest: def build_string_put_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/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) @@ -77,13 +81,12 @@ def build_boolean_get_request(**kwargs: Any) -> HttpRequest: def build_boolean_put_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/boolean" # 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) @@ -105,13 +108,12 @@ def build_unknown_get_request(**kwargs: Any) -> HttpRequest: def build_unknown_put_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/unknown" # 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) @@ -133,13 +135,12 @@ def build_decimal_type_response_body_request(**kwargs: Any) -> HttpRequest: def build_decimal_type_request_body_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/decimal/resquest_body" # 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) @@ -175,13 +176,12 @@ def build_decimal128_type_response_body_request(**kwargs: Any) -> HttpRequest: def build_decimal128_type_request_body_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/decimal128/resquest_body" # 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) @@ -217,13 +217,12 @@ def build_decimal_verify_prepare_verify_request(**kwargs: Any) -> HttpRequest: def build_decimal_verify_verify_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/decimal/verify" # 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) @@ -245,13 +244,12 @@ def build_decimal128_verify_prepare_verify_request(**kwargs: Any) -> HttpRequest def build_decimal128_verify_verify_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type: str = kwargs.pop("content_type") # Construct URL _url = "/type/scalar/decimal128/verify" # 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) @@ -280,7 +278,7 @@ def get(self, **kwargs: Any) -> str: :rtype: str :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,7 +329,7 @@ def put(self, body: str, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,7 +394,7 @@ def get(self, **kwargs: Any) -> bool: :rtype: bool :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +445,7 @@ def put(self, body: bool, **kwargs: Any) -> None: # pylint: disable=inconsisten :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -512,7 +510,7 @@ def get(self, **kwargs: Any) -> Any: :rtype: any :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -563,7 +561,7 @@ def put(self, body: Any, **kwargs: Any) -> None: # pylint: disable=inconsistent :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -628,7 +626,7 @@ def response_body(self, **kwargs: Any) -> decimal.Decimal: :rtype: ~decimal.Decimal :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -681,7 +679,7 @@ def request_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -732,7 +730,7 @@ def request_parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -793,7 +791,7 @@ def response_body(self, **kwargs: Any) -> decimal.Decimal: :rtype: ~decimal.Decimal :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -846,7 +844,7 @@ def request_body( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -897,7 +895,7 @@ def request_parameter( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -966,7 +964,7 @@ def prepare_verify(self, **kwargs: Any) -> List[decimal.Decimal]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1017,7 +1015,7 @@ def verify(self, body: decimal.Decimal, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1090,7 +1088,7 @@ def prepare_verify(self, **kwargs: Any) -> List[decimal.Decimal]: 0.0 # Optional. ] """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1141,7 +1139,7 @@ def verify(self, body: decimal.Decimal, **kwargs: Any) -> None: # pylint: disab :rtype: None :raises ~corehttp.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/aio/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/aio/operations/_operations.py index ae01d805c5e..00402ce178c 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/aio/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/aio/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -76,6 +76,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def get(self, **kwargs: Any) -> _models.GetResponse9: + # pylint: disable=line-too-long """get. :return: GetResponse9. The GetResponse9 is compatible with MutableMapping @@ -87,10 +88,11 @@ async def get(self, **kwargs: Any) -> _models.GetResponse9: # response body for status code(s): 200 response == { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,6 +138,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse9: async def send( # pylint: disable=inconsistent-return-statements self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """send. :param body: Required. @@ -152,18 +155,20 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ @overload async def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[str, _models.GetResponseProp5], content_type: str = "application/json", **kwargs: Any + self, *, prop: Literal["a", "b", "c"], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: "a", "b", and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp5 + :keyword prop: Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + Required. + :paramtype prop: str or str or str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -189,18 +194,16 @@ async def send( # pylint: disable=inconsistent-return-statements """ async def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[str, _models.GetResponseProp5] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: Literal["a", "b", "c"] = _Unset, **kwargs: Any ) -> None: + # pylint: disable=line-too-long """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: "a", "b", and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp5 + :keyword prop: Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + Required. + :paramtype prop: str or str or str :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -210,10 +213,11 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -293,10 +297,11 @@ async def get(self, **kwargs: Any) -> _models.GetResponse8: # response body for status code(s): 200 response == { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,18 +363,19 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ @overload async def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[str, _models.GetResponseProp4], content_type: str = "application/json", **kwargs: Any + self, *, prop: Union[Literal["b"], Literal["c"], str], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: "b" and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp4 + :keyword prop: Is one of the following types: Literal["b"], Literal["c"], str Required. + :paramtype prop: str or str or str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -398,15 +404,15 @@ async def send( # pylint: disable=inconsistent-return-statements self, body: Union[JSON, IO[bytes]] = _Unset, *, - prop: Union[str, _models.GetResponseProp4] = _Unset, + prop: Union[Literal["b"], Literal["c"], str] = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: "b" and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp4 + :keyword prop: Is one of the following types: Literal["b"], Literal["c"], str Required. + :paramtype prop: str or str or str :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -416,10 +422,11 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -502,7 +509,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse7: "prop": "str" # Required. Known values are: "b" and "c". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +636,7 @@ async def send( # pylint: disable=inconsistent-return-statements "prop": "str" # Required. Known values are: "b" and "c". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,10 +716,11 @@ async def get(self, **kwargs: Any) -> _models.GetResponse6: # response body for status code(s): 200 response == { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,18 +782,19 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ @overload async def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[int, _models.GetResponseProp3], content_type: str = "application/json", **kwargs: Any + self, *, prop: Literal[1, 2, 3], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: 1, 2, and 3. Required. - :paramtype prop: int or ~typetest.union.models.GetResponseProp3 + :keyword prop: Is one of the following types: Literal[1], Literal[2], Literal[3] Required. + :paramtype prop: int or int or int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -811,18 +820,14 @@ async def send( # pylint: disable=inconsistent-return-statements """ async def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[int, _models.GetResponseProp3] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: Literal[1, 2, 3] = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: 1, 2, and 3. Required. - :paramtype prop: int or ~typetest.union.models.GetResponseProp3 + :keyword prop: Is one of the following types: Literal[1], Literal[2], Literal[3] Required. + :paramtype prop: int or int or int :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -832,10 +837,11 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -915,10 +921,11 @@ async def get(self, **kwargs: Any) -> _models.GetResponse5: # response body for status code(s): 200 response == { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -980,18 +987,19 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ @overload async def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[float, _models.GetResponseProp2], content_type: str = "application/json", **kwargs: Any + self, *, prop: float, content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: 1.1, 2.2, and 3.3. Required. - :paramtype prop: float or ~typetest.union.models.GetResponseProp2 + :keyword prop: Is one of the following types: float, float, float Required. + :paramtype prop: float or float or float :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1017,18 +1025,14 @@ async def send( # pylint: disable=inconsistent-return-statements """ async def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[float, _models.GetResponseProp2] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: float = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: 1.1, 2.2, and 3.3. Required. - :paramtype prop: float or ~typetest.union.models.GetResponseProp2 + :keyword prop: Is one of the following types: float, float, float Required. + :paramtype prop: float or float or float :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1038,10 +1042,11 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1126,7 +1131,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse4: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1249,7 +1254,7 @@ async def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1331,14 +1336,16 @@ async def get(self, **kwargs: Any) -> _models.GetResponse3: # response body for status code(s): 200 response == { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1402,10 +1409,12 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ @@ -1462,14 +1471,16 @@ async def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1558,7 +1569,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse2: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1689,7 +1700,7 @@ async def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1786,7 +1797,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse1: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1933,7 +1944,7 @@ async def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2029,7 +2040,7 @@ async def get(self, **kwargs: Any) -> _models.GetResponse: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2174,7 +2185,7 @@ async def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/__init__.py b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/__init__.py index 8b861ffd992..84eb9ca3e64 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/__init__.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/__init__.py @@ -23,12 +23,6 @@ from ._models import MixedTypesCases from ._models import StringAndArrayCases -from ._enums import EnumsOnlyCasesLr -from ._enums import EnumsOnlyCasesUd -from ._enums import GetResponseProp2 -from ._enums import GetResponseProp3 -from ._enums import GetResponseProp4 -from ._enums import GetResponseProp5 from ._enums import StringExtensibleNamedUnion from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -51,12 +45,6 @@ "MixedLiteralsCases", "MixedTypesCases", "StringAndArrayCases", - "EnumsOnlyCasesLr", - "EnumsOnlyCasesUd", - "GetResponseProp2", - "GetResponseProp3", - "GetResponseProp4", - "GetResponseProp5", "StringExtensibleNamedUnion", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/_enums.py b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/_enums.py index d5ceb027448..23968fa38b4 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/_enums.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/_enums.py @@ -10,53 +10,6 @@ from corehttp.utils import CaseInsensitiveEnumMeta -class EnumsOnlyCasesLr(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of EnumsOnlyCasesLr.""" - - LEFT = "left" - RIGHT = "right" - UP = "up" - DOWN = "down" - - -class EnumsOnlyCasesUd(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of EnumsOnlyCasesUd.""" - - UP = "up" - DOWN = "down" - - -class GetResponseProp2(float, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of GetResponseProp2.""" - - ENUM_1_1 = 1.1 - ENUM_2_2 = 2.2 - ENUM_3_3 = 3.3 - - -class GetResponseProp3(int, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of GetResponseProp3.""" - - ENUM_1 = 1 - ENUM_2 = 2 - ENUM_3 = 3 - - -class GetResponseProp4(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of GetResponseProp4.""" - - B = "b" - C = "c" - - -class GetResponseProp5(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of GetResponseProp5.""" - - A = "a" - B = "b" - C = "c" - - class StringExtensibleNamedUnion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of StringExtensibleNamedUnion.""" diff --git a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/_models.py b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/_models.py index 5a86ebb52c5..b7e73904736 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/_models.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/models/_models.py @@ -91,26 +91,27 @@ class EnumsOnlyCases(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar lr: This should be receive/send the left variant. Required. Known values are: "left", - "right", "up", and "down". - :vartype lr: str or ~typetest.union.models.EnumsOnlyCasesLr - :ivar ud: This should be receive/send the up variant. Required. Known values are: "up" and - "down". - :vartype ud: str or ~typetest.union.models.EnumsOnlyCasesUd + :ivar lr: This should be receive/send the left variant. Required. Is one of the following + types: Literal["left"], Literal["right"], Literal["up"], Literal["down"] + :vartype lr: str or str or str or str + :ivar ud: This should be receive/send the up variant. Required. Is either a Literal["up"] type + or a Literal["down"] type. + :vartype ud: str or str """ - lr: Union[str, "_models.EnumsOnlyCasesLr"] = rest_field() - """This should be receive/send the left variant. Required. Known values are: \"left\", \"right\", - \"up\", and \"down\".""" - ud: Union[str, "_models.EnumsOnlyCasesUd"] = rest_field() - """This should be receive/send the up variant. Required. Known values are: \"up\" and \"down\".""" + lr: Literal["left", "right", "up", "down"] = rest_field() + """This should be receive/send the left variant. Required. Is one of the following types: + Literal[\"left\"], Literal[\"right\"], Literal[\"up\"], Literal[\"down\"]""" + ud: Literal["up", "down"] = rest_field() + """This should be receive/send the up variant. Required. Is either a Literal[\"up\"] type or a + Literal[\"down\"] type.""" @overload def __init__( self, *, - lr: Union[str, "_models.EnumsOnlyCasesLr"], - ud: Union[str, "_models.EnumsOnlyCasesUd"], + lr: Literal["left", "right", "up", "down"], + ud: Literal["up", "down"], ): ... @@ -285,18 +286,18 @@ class GetResponse5(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar prop: Required. Known values are: 1.1, 2.2, and 3.3. - :vartype prop: float or ~typetest.union.models.GetResponseProp2 + :ivar prop: Required. Is one of the following types: float, float, float + :vartype prop: float or float or float """ - prop: Union[float, "_models.GetResponseProp2"] = rest_field() - """Required. Known values are: 1.1, 2.2, and 3.3.""" + prop: float = rest_field() + """Required. Is one of the following types: float, float, float""" @overload def __init__( self, *, - prop: Union[float, "_models.GetResponseProp2"], + prop: float, ): ... @@ -316,18 +317,18 @@ class GetResponse6(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar prop: Required. Known values are: 1, 2, and 3. - :vartype prop: int or ~typetest.union.models.GetResponseProp3 + :ivar prop: Required. Is one of the following types: Literal[1], Literal[2], Literal[3] + :vartype prop: int or int or int """ - prop: Union[int, "_models.GetResponseProp3"] = rest_field() - """Required. Known values are: 1, 2, and 3.""" + prop: Literal[1, 2, 3] = rest_field() + """Required. Is one of the following types: Literal[1], Literal[2], Literal[3]""" @overload def __init__( self, *, - prop: Union[int, "_models.GetResponseProp3"], + prop: Literal[1, 2, 3], ): ... @@ -378,18 +379,18 @@ class GetResponse8(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar prop: Required. Known values are: "b" and "c". - :vartype prop: str or ~typetest.union.models.GetResponseProp4 + :ivar prop: Required. Is one of the following types: Literal["b"], Literal["c"], str + :vartype prop: str or str or str """ - prop: Union[str, "_models.GetResponseProp4"] = rest_field() - """Required. Known values are: \"b\" and \"c\".""" + prop: Union[Literal["b"], Literal["c"], str] = rest_field() + """Required. Is one of the following types: Literal[\"b\"], Literal[\"c\"], str""" @overload def __init__( self, *, - prop: Union[str, "_models.GetResponseProp4"], + prop: Union[Literal["b"], Literal["c"], str], ): ... @@ -409,18 +410,18 @@ class GetResponse9(_model_base.Model): All required parameters must be populated in order to send to server. - :ivar prop: Required. Known values are: "a", "b", and "c". - :vartype prop: str or ~typetest.union.models.GetResponseProp5 + :ivar prop: Required. Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + :vartype prop: str or str or str """ - prop: Union[str, "_models.GetResponseProp5"] = rest_field() - """Required. Known values are: \"a\", \"b\", and \"c\".""" + prop: Literal["a", "b", "c"] = rest_field() + """Required. Is one of the following types: Literal[\"a\"], Literal[\"b\"], Literal[\"c\"]""" @overload def __init__( self, *, - prop: Union[str, "_models.GetResponseProp5"], + prop: Literal["a", "b", "c"], ): ... diff --git a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/operations/_operations.py b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/operations/_operations.py index acaa20f9d77..e9974ef407f 100644 --- a/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/operations/_operations.py +++ b/packages/typespec-python/test/unbranded/generated/typetest-union/typetest/union/operations/_operations.py @@ -9,7 +9,7 @@ from io import IOBase import json import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, overload from corehttp.exceptions import ( ClientAuthenticationError, @@ -338,6 +338,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def get(self, **kwargs: Any) -> _models.GetResponse9: + # pylint: disable=line-too-long """get. :return: GetResponse9. The GetResponse9 is compatible with MutableMapping @@ -349,10 +350,11 @@ def get(self, **kwargs: Any) -> _models.GetResponse9: # response body for status code(s): 200 response == { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,6 +400,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse9: def send( # pylint: disable=inconsistent-return-statements self, body: JSON, *, content_type: str = "application/json", **kwargs: Any ) -> None: + # pylint: disable=line-too-long """send. :param body: Required. @@ -414,18 +417,20 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ @overload def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[str, _models.GetResponseProp5], content_type: str = "application/json", **kwargs: Any + self, *, prop: Literal["a", "b", "c"], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: "a", "b", and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp5 + :keyword prop: Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + Required. + :paramtype prop: str or str or str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -451,18 +456,16 @@ def send( # pylint: disable=inconsistent-return-statements """ def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[str, _models.GetResponseProp5] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: Literal["a", "b", "c"] = _Unset, **kwargs: Any ) -> None: + # pylint: disable=line-too-long """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: "a", "b", and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp5 + :keyword prop: Is one of the following types: Literal["a"], Literal["b"], Literal["c"] + Required. + :paramtype prop: str or str or str :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -472,10 +475,11 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "a", "b", and "c". + "prop": "a" # Default value is "a". Required. Is one of the following types: + Literal["a"], Literal["b"], Literal["c"] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,10 +559,11 @@ def get(self, **kwargs: Any) -> _models.GetResponse8: # response body for status code(s): 200 response == { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,18 +625,19 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ @overload def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[str, _models.GetResponseProp4], content_type: str = "application/json", **kwargs: Any + self, *, prop: Union[Literal["b"], Literal["c"], str], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: "b" and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp4 + :keyword prop: Is one of the following types: Literal["b"], Literal["c"], str Required. + :paramtype prop: str or str or str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -660,15 +666,15 @@ def send( # pylint: disable=inconsistent-return-statements self, body: Union[JSON, IO[bytes]] = _Unset, *, - prop: Union[str, _models.GetResponseProp4] = _Unset, + prop: Union[Literal["b"], Literal["c"], str] = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: "b" and "c". Required. - :paramtype prop: str or ~typetest.union.models.GetResponseProp4 + :keyword prop: Is one of the following types: Literal["b"], Literal["c"], str Required. + :paramtype prop: str or str or str :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -678,10 +684,11 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": "str" # Required. Known values are: "b" and "c". + "prop": "b" # Default value is "b". Required. Is one of the following types: + Literal["b"], Literal["c"], str } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -764,7 +771,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse7: "prop": "str" # Required. Known values are: "b" and "c". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -891,7 +898,7 @@ def send( # pylint: disable=inconsistent-return-statements "prop": "str" # Required. Known values are: "b" and "c". } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -971,10 +978,11 @@ def get(self, **kwargs: Any) -> _models.GetResponse6: # response body for status code(s): 200 response == { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1036,18 +1044,19 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ @overload def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[int, _models.GetResponseProp3], content_type: str = "application/json", **kwargs: Any + self, *, prop: Literal[1, 2, 3], content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: 1, 2, and 3. Required. - :paramtype prop: int or ~typetest.union.models.GetResponseProp3 + :keyword prop: Is one of the following types: Literal[1], Literal[2], Literal[3] Required. + :paramtype prop: int or int or int :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1073,18 +1082,14 @@ def send( # pylint: disable=inconsistent-return-statements """ def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[int, _models.GetResponseProp3] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: Literal[1, 2, 3] = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: 1, 2, and 3. Required. - :paramtype prop: int or ~typetest.union.models.GetResponseProp3 + :keyword prop: Is one of the following types: Literal[1], Literal[2], Literal[3] Required. + :paramtype prop: int or int or int :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1094,10 +1099,11 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0 # Required. Known values are: 1, 2, and 3. + "prop": 1 # Default value is 1. Required. Is one of the following types: + Literal[1], Literal[2], Literal[3] } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1177,10 +1183,11 @@ def get(self, **kwargs: Any) -> _models.GetResponse5: # response body for status code(s): 200 response == { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1242,18 +1249,19 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ @overload def send( # pylint: disable=inconsistent-return-statements - self, *, prop: Union[float, _models.GetResponseProp2], content_type: str = "application/json", **kwargs: Any + self, *, prop: float, content_type: str = "application/json", **kwargs: Any ) -> None: """send. - :keyword prop: Known values are: 1.1, 2.2, and 3.3. Required. - :paramtype prop: float or ~typetest.union.models.GetResponseProp2 + :keyword prop: Is one of the following types: float, float, float Required. + :paramtype prop: float or float or float :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1279,18 +1287,14 @@ def send( # pylint: disable=inconsistent-return-statements """ def send( # pylint: disable=inconsistent-return-statements - self, - body: Union[JSON, IO[bytes]] = _Unset, - *, - prop: Union[float, _models.GetResponseProp2] = _Unset, - **kwargs: Any + self, body: Union[JSON, IO[bytes]] = _Unset, *, prop: float = _Unset, **kwargs: Any ) -> None: """send. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] - :keyword prop: Known values are: 1.1, 2.2, and 3.3. Required. - :paramtype prop: float or ~typetest.union.models.GetResponseProp2 + :keyword prop: Is one of the following types: float, float, float Required. + :paramtype prop: float or float or float :return: None :rtype: None :raises ~corehttp.exceptions.HttpResponseError: @@ -1300,10 +1304,11 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { - "prop": 0.0 # Required. Known values are: 1.1, 2.2, and 3.3. + "prop": 1.1 # Default value is 1.1. Required. Is one of the following types: + float, float, float } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1388,7 +1393,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse4: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1511,7 +1516,7 @@ def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1593,14 +1598,16 @@ def get(self, **kwargs: Any) -> _models.GetResponse3: # response body for status code(s): 200 response == { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1664,10 +1671,12 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ @@ -1724,14 +1733,16 @@ def send( # pylint: disable=inconsistent-return-statements # JSON input template you can fill out and use as your body input. body = { "prop": { - "lr": "str", # This should be receive/send the left variant. - Required. Known values are: "left", "right", "up", and "down". - "ud": "str" # This should be receive/send the up variant. Required. - Known values are: "up" and "down". + "lr": "left", # Default value is "left". This should be receive/send + the left variant. Required. Is one of the following types: Literal["left"], + Literal["right"], Literal["up"], Literal["down"] + "ud": "up" # Default value is "up". This should be receive/send the + up variant. Required. Is either a Literal["up"] type or a Literal["down"] + type. } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1820,7 +1831,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse2: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1951,7 +1962,7 @@ def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2048,7 +2059,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse1: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2195,7 +2206,7 @@ def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2291,7 +2302,7 @@ def get(self, **kwargs: Any) -> _models.GetResponse: } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2436,7 +2447,7 @@ def send( # pylint: disable=inconsistent-return-statements } } """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/packages/typespec-python/test/unbranded/requirements.txt b/packages/typespec-python/test/unbranded/requirements.txt index ea8523dc193..31d55d91204 100644 --- a/packages/typespec-python/test/unbranded/requirements.txt +++ b/packages/typespec-python/test/unbranded/requirements.txt @@ -13,10 +13,10 @@ corehttp==1.0.0b3 -e ./generated/encode-duration -e ./generated/parameters-collection-format -e ./generated/parameters-spread --e ./generated/projection-projected-name -e ./generated/resiliency-srv-driven1 -e ./generated/resiliency-srv-driven2 -e ./generated/serialization-encoded-name-json +-e ./generated/server-endpoint-not-defined -e ./generated/server-path-multiple -e ./generated/server-path-single -e ./generated/server-versions-versioned diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ed197829e98..4351f4b7d45 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: devDependencies: '@azure-tools/cadl-ranch': - specifier: ~0.11.2 - version: 0.11.2(@typespec/versioning@0.51.0) + specifier: ~0.11.3 + version: 0.11.3(@typespec/versioning@0.52.0) '@typespec/prettier-plugin-typespec': specifier: ~0.51.0 version: 0.51.0 @@ -18,14 +18,14 @@ importers: specifier: 3.6.3 version: 3.6.3 eslint: - specifier: ^8.44.0 - version: 8.44.0 + specifier: ^8.57.0 + version: 8.57.0 eslint-plugin-import: - specifier: ^2.27.5 - version: 2.27.5(eslint@8.44.0) + specifier: ^2.29.1 + version: 2.29.1(eslint@8.57.0) eslint-plugin-unicorn: - specifier: ^46.0.0 - version: 46.0.0(eslint@8.44.0) + specifier: ^46.0.1 + version: 46.0.1(eslint@8.57.0) prettier: specifier: ^2.8.8 version: 2.8.8 @@ -33,8 +33,8 @@ importers: specifier: ^9.8.6 version: 9.8.6 typescript: - specifier: ~5.1.3 - version: 5.1.3 + specifier: ~5.1.6 + version: 5.1.6 packages/autorest.python: dependencies: @@ -56,29 +56,29 @@ importers: version: link:../autorest.python '@typespec/openapi3': specifier: latest - version: 0.53.2(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/openapi@0.54.0)(@typespec/versioning@0.54.0) + version: 0.53.2(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/versioning@0.55.0) js-yaml: specifier: ~4.1.0 version: 4.1.0 devDependencies: '@azure-tools/cadl-ranch-expect': specifier: ~0.13.1 - version: 0.13.1(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0) + version: 0.13.1(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@azure-tools/cadl-ranch-specs': - specifier: ~0.31.0 - version: 0.31.0(@azure-tools/cadl-ranch-expect@0.13.1)(@azure-tools/typespec-azure-core@0.40.0)(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0) + specifier: ~0.31.6 + version: 0.31.6(@azure-tools/cadl-ranch-expect@0.13.1)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@azure-tools/typespec-autorest': - specifier: ~0.40.0 - version: 0.40.0(@azure-tools/typespec-azure-core@0.40.0)(@azure-tools/typespec-client-generator-core@0.40.0)(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/openapi@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0) + specifier: ~0.41.0 + version: 0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.1)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@azure-tools/typespec-azure-core': - specifier: ~0.40.0 - version: 0.40.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0) + specifier: ~0.41.0 + version: 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) '@azure-tools/typespec-azure-resource-manager': - specifier: ~0.40.0 - version: 0.40.0(@azure-tools/typespec-autorest@0.40.0)(@azure-tools/typespec-azure-core@0.40.0)(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/openapi@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0) + specifier: ~0.41.0 + version: 0.41.0(@azure-tools/typespec-autorest@0.41.0)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@azure-tools/typespec-client-generator-core': - specifier: ~0.40.0 - version: 0.40.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0) + specifier: ~0.41.1 + version: 0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) '@types/js-yaml': specifier: ~4.0.5 version: 4.0.5 @@ -89,23 +89,23 @@ importers: specifier: ^18.16.3 version: 18.16.3 '@typespec/compiler': - specifier: ~0.54.0 - version: 0.54.0 + specifier: ~0.55.0 + version: 0.55.0 '@typespec/eslint-config-typespec': - specifier: ~0.54.0 - version: 0.54.0(prettier@3.1.1) + specifier: ~0.55.0 + version: 0.55.0(prettier@3.2.5) '@typespec/http': - specifier: ~0.54.0 - version: 0.54.0(@typespec/compiler@0.54.0) + specifier: ~0.55.0 + version: 0.55.0(@typespec/compiler@0.55.0) '@typespec/openapi': - specifier: ~0.54.0 - version: 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) + specifier: ~0.55.0 + version: 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) '@typespec/rest': - specifier: ~0.54.0 - version: 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) + specifier: ~0.55.0 + version: 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) '@typespec/versioning': - specifier: ~0.54.0 - version: 0.54.0(@typespec/compiler@0.54.0) + specifier: ~0.55.0 + version: 0.55.0(@typespec/compiler@0.55.0) c8: specifier: ~7.13.0 version: 7.13.0 @@ -160,20 +160,20 @@ packages: - supports-color dev: true - /@azure-tools/cadl-ranch-coverage-sdk@0.6.1: - resolution: {integrity: sha512-eQuzWblWdNLXZOVO+QMwFt3n+Y/DCekfmYK6XxNcASbh5KlL4hFkwg1Jjtm7bt/Eb+0uqmwAFnPDx7C+rCRCFQ==} + /@azure-tools/cadl-ranch-coverage-sdk@0.7.0: + resolution: {integrity: sha512-OGQzFPi/oMDCPU6JW4XealTB7b91+MoBwWEnsInD1EFBJ/5rNRlvovJj39jlk61TMpor5x++9DR4Vud5/hyQAw==} engines: {node: '>=16.0.0'} dependencies: - '@azure/identity': 3.3.0 - '@azure/storage-blob': 12.15.0 - '@types/node': 18.16.3 + '@azure/identity': 3.4.2 + '@azure/storage-blob': 12.17.0 + '@types/node': 18.19.29 transitivePeerDependencies: - encoding - supports-color dev: true - /@azure-tools/cadl-ranch-coverage-sdk@0.8.0: - resolution: {integrity: sha512-jL+bmnJRy+J88KHeEpvIOqOzhYAPuo6l+d7N9qphthdsK5x0FxPazeVdZWbZ7fnipWz6J4NMaSTvv/b0v7rZNw==} + /@azure-tools/cadl-ranch-coverage-sdk@0.8.1: + resolution: {integrity: sha512-gvt5NElamTmId/puH2iblJYCMKghL6/jUm3tB49LHOYFXwKdnz9Vss9cNSsmdCctGGbRutFu+9CGTzS5aiXwGw==} engines: {node: '>=16.0.0'} dependencies: '@azure/identity': 3.3.0 @@ -184,22 +184,22 @@ packages: - supports-color dev: true - /@azure-tools/cadl-ranch-expect@0.11.0(@typespec/compiler@0.51.0)(@typespec/http@0.51.0)(@typespec/rest@0.51.0)(@typespec/versioning@0.51.0): - resolution: {integrity: sha512-0iTdWr8X+Su+3HIfg1glIzlMzXdsIHKIAAZ8ks480wCVwkcCJQtFn4AtSYXLY2FWf0b6jzb+51BvDpAi0SSwqQ==} + /@azure-tools/cadl-ranch-expect@0.12.0(@typespec/compiler@0.52.0)(@typespec/http@0.52.1)(@typespec/rest@0.52.0)(@typespec/versioning@0.52.0): + resolution: {integrity: sha512-KrcNGQNdSSI3nM44ESgp6PIX4dA0N/9rRN0j8m70jI0OyzjedjMrIs7ujUy3RW7CaXNO8VpE9HXoL4pXMP/IxQ==} engines: {node: '>=16.0.0'} peerDependencies: - '@typespec/compiler': ~0.51.0 - '@typespec/http': ~0.51.0 - '@typespec/rest': ~0.51.0 - '@typespec/versioning': ~0.51.0 + '@typespec/compiler': ~0.52.0 + '@typespec/http': ~0.52.0 + '@typespec/rest': ~0.52.0 + '@typespec/versioning': ~0.52.0 dependencies: - '@typespec/compiler': 0.51.0 - '@typespec/http': 0.51.0(@typespec/compiler@0.51.0) - '@typespec/rest': 0.51.0(@typespec/compiler@0.51.0)(@typespec/http@0.51.0) - '@typespec/versioning': 0.51.0(@typespec/compiler@0.51.0) + '@typespec/compiler': 0.52.0 + '@typespec/http': 0.52.1(@typespec/compiler@0.52.0) + '@typespec/rest': 0.52.0(@typespec/compiler@0.52.0)(@typespec/http@0.52.1) + '@typespec/versioning': 0.52.0(@typespec/compiler@0.52.0) dev: true - /@azure-tools/cadl-ranch-expect@0.13.1(@typespec/compiler@0.53.1)(@typespec/http@0.53.0)(@typespec/rest@0.53.0)(@typespec/versioning@0.54.0): + /@azure-tools/cadl-ranch-expect@0.13.1(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): resolution: {integrity: sha512-bvoJhPCMopKsCkEat0CgouQF4eGUUdOKoeFUrsOqp6n6E9ecOjmojRQNoJT6NDF2KEf9og874PWvSzOJhmnKgw==} engines: {node: '>=16.0.0'} peerDependencies: @@ -208,71 +208,71 @@ packages: '@typespec/rest': ~0.53.0 '@typespec/versioning': ~0.53.0 dependencies: - '@typespec/compiler': 0.53.1 - '@typespec/http': 0.53.0(@typespec/compiler@0.53.1) - '@typespec/rest': 0.53.0(@typespec/compiler@0.53.1)(@typespec/http@0.53.0) - '@typespec/versioning': 0.54.0(@typespec/compiler@0.54.0) + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) dev: true - /@azure-tools/cadl-ranch-expect@0.13.1(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0): - resolution: {integrity: sha512-bvoJhPCMopKsCkEat0CgouQF4eGUUdOKoeFUrsOqp6n6E9ecOjmojRQNoJT6NDF2KEf9og874PWvSzOJhmnKgw==} + /@azure-tools/cadl-ranch-expect@0.13.2(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.55.0): + resolution: {integrity: sha512-5W/jcyfQHeJ7QJZ/fQyIzYn/D9rXlxL8zWELTs/wnVlT3Cf45kJT83+SwKqMPAN/bJsWSnebS84mRAHhQijmZA==} engines: {node: '>=16.0.0'} peerDependencies: - '@typespec/compiler': ~0.53.1 - '@typespec/http': ~0.53.0 - '@typespec/rest': ~0.53.0 - '@typespec/versioning': ~0.53.0 + '@typespec/compiler': ~0.54.0 + '@typespec/http': ~0.54.0 + '@typespec/rest': ~0.54.0 + '@typespec/versioning': ~0.54.0 dependencies: '@typespec/compiler': 0.54.0 '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) '@typespec/rest': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) - '@typespec/versioning': 0.54.0(@typespec/compiler@0.54.0) + '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) dev: true - /@azure-tools/cadl-ranch-specs@0.31.0(@azure-tools/cadl-ranch-expect@0.13.1)(@azure-tools/typespec-azure-core@0.40.0)(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0): - resolution: {integrity: sha512-NsSFhOTiYr7T2PjoFww1vieN6MSMIeVReU/CjlPhaZF2hiKfFffGRvIS8lWXv8QpySHi1/O8p5YasKqMUACwgA==} + /@azure-tools/cadl-ranch-specs@0.31.6(@azure-tools/cadl-ranch-expect@0.13.1)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): + resolution: {integrity: sha512-R56QyANH4g9AMdJg35CTqBH0Z4l0OXJm9piGBHzrTj9t3FRyefH+P2j7mSjcfALvG9HdWF1xhbawd13R4L9HbQ==} engines: {node: '>=16.0.0'} peerDependencies: - '@azure-tools/cadl-ranch-expect': ~0.13.1 - '@azure-tools/typespec-azure-core': ~0.39.1 - '@typespec/compiler': ~0.53.1 - '@typespec/http': ~0.53.0 - '@typespec/rest': ~0.53.0 - '@typespec/versioning': ~0.53.0 + '@azure-tools/cadl-ranch-expect': ~0.13.2 + '@azure-tools/typespec-azure-core': ~0.40.0 + '@typespec/compiler': ~0.54.0 + '@typespec/http': ~0.54.0 + '@typespec/rest': ~0.54.0 + '@typespec/versioning': ~0.54.0 dependencies: - '@azure-tools/cadl-ranch': 0.12.2(@typespec/versioning@0.54.0) + '@azure-tools/cadl-ranch': 0.12.5(@typespec/versioning@0.55.0) '@azure-tools/cadl-ranch-api': 0.4.3 - '@azure-tools/cadl-ranch-expect': 0.13.1(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0) - '@azure-tools/typespec-azure-core': 0.40.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0) - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) - '@typespec/rest': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) - '@typespec/versioning': 0.54.0(@typespec/compiler@0.54.0) + '@azure-tools/cadl-ranch-expect': 0.13.1(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) transitivePeerDependencies: - '@types/express' - encoding - supports-color dev: true - /@azure-tools/cadl-ranch@0.11.2(@typespec/versioning@0.51.0): - resolution: {integrity: sha512-7y8k2fvlo3+UolO93u7itmfkRzLW4ToknJaNA3nK2X7Nvkm80efFvdchgfl/wAdr+rt7Ms5o5DvDzlKj2vOu8g==} + /@azure-tools/cadl-ranch@0.11.3(@typespec/versioning@0.52.0): + resolution: {integrity: sha512-Nw8VNUxa/jfrOWpT7YjINap5JDaE5gWNKcOHVexcnMu/jlFkCqUo5z4jiJuKdr7oPn8NYoIv4ajwKx2XQ72sfA==} engines: {node: '>=16.0.0'} hasBin: true dependencies: '@azure-tools/cadl-ranch-api': 0.4.3 - '@azure-tools/cadl-ranch-coverage-sdk': 0.6.1 - '@azure-tools/cadl-ranch-expect': 0.11.0(@typespec/compiler@0.51.0)(@typespec/http@0.51.0)(@typespec/rest@0.51.0)(@typespec/versioning@0.51.0) - '@azure/identity': 3.3.0 - '@types/js-yaml': 4.0.5 - '@typespec/compiler': 0.51.0 - '@typespec/http': 0.51.0(@typespec/compiler@0.51.0) - '@typespec/rest': 0.51.0(@typespec/compiler@0.51.0)(@typespec/http@0.51.0) + '@azure-tools/cadl-ranch-coverage-sdk': 0.7.0 + '@azure-tools/cadl-ranch-expect': 0.12.0(@typespec/compiler@0.52.0)(@typespec/http@0.52.1)(@typespec/rest@0.52.0)(@typespec/versioning@0.52.0) + '@azure/identity': 3.4.2 + '@types/js-yaml': 4.0.9 + '@typespec/compiler': 0.52.0 + '@typespec/http': 0.52.1(@typespec/compiler@0.52.0) + '@typespec/rest': 0.52.0(@typespec/compiler@0.52.0)(@typespec/http@0.52.1) ajv: 8.12.0 body-parser: 1.20.2 - deep-equal: 2.2.2 - express: 4.18.2 - express-promise-router: 4.1.1(express@4.18.2) - glob: 10.3.3 + deep-equal: 2.2.3 + express: 4.19.2 + express-promise-router: 4.1.1(express@4.19.2) + glob: 10.3.12 jackspeak: 2.1.1 js-yaml: 4.1.0 morgan: 1.10.0 @@ -280,7 +280,7 @@ packages: node-fetch: 3.3.2 picocolors: 1.0.0 source-map-support: 0.5.21 - winston: 3.10.0 + winston: 3.13.0 xml2js: 0.5.0 yargs: 17.7.2 transitivePeerDependencies: @@ -290,24 +290,24 @@ packages: - supports-color dev: true - /@azure-tools/cadl-ranch@0.12.2(@typespec/versioning@0.54.0): - resolution: {integrity: sha512-Zc2kf5UJ8bcBcryQ5Lp7CIDP5gg2bRepYfBJM3c6mWSgIY6FcALqQLDlVip1oHY0HsGhJ08pSlvZHJ2czlf/DA==} + /@azure-tools/cadl-ranch@0.12.5(@typespec/versioning@0.55.0): + resolution: {integrity: sha512-ZoIHsVD+URktQ4HX/zMAYKKcuEY48Hlh/F/+aq9YXj6SD8WCIhczqg9RkTuYBAhTk8v/kPkoBhXyMC1jx5/PiA==} engines: {node: '>=16.0.0'} hasBin: true dependencies: '@azure-tools/cadl-ranch-api': 0.4.3 - '@azure-tools/cadl-ranch-coverage-sdk': 0.8.0 - '@azure-tools/cadl-ranch-expect': 0.13.1(@typespec/compiler@0.53.1)(@typespec/http@0.53.0)(@typespec/rest@0.53.0)(@typespec/versioning@0.54.0) + '@azure-tools/cadl-ranch-coverage-sdk': 0.8.1 + '@azure-tools/cadl-ranch-expect': 0.13.2(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.55.0) '@azure/identity': 3.3.0 '@types/js-yaml': 4.0.5 - '@typespec/compiler': 0.53.1 - '@typespec/http': 0.53.0(@typespec/compiler@0.53.1) - '@typespec/rest': 0.53.0(@typespec/compiler@0.53.1)(@typespec/http@0.53.0) + '@typespec/compiler': 0.54.0 + '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) + '@typespec/rest': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) ajv: 8.12.0 body-parser: 1.20.2 deep-equal: 2.2.2 - express: 4.18.2 - express-promise-router: 4.1.1(express@4.18.2) + express: 4.19.2 + express-promise-router: 4.1.1(express@4.19.2) glob: 10.3.3 jackspeak: 2.1.1 js-yaml: 4.1.0 @@ -326,74 +326,76 @@ packages: - supports-color dev: true - /@azure-tools/typespec-autorest@0.40.0(@azure-tools/typespec-azure-core@0.40.0)(@azure-tools/typespec-client-generator-core@0.40.0)(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/openapi@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0): - resolution: {integrity: sha512-aMgJk0pudvg11zs/2dlUWPEsdK920NvTqGkbYhy+4UeJ1hEzMM3btOyujE/irhDlcZeEgDlaXQc+xiK/Vik71A==} + /@azure-tools/typespec-autorest@0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.1)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): + resolution: {integrity: sha512-yMbzIXKO7jH2+w69nhrQoq6tsvEls1rP62bBduFNY8wGsYNirTnbyRoRmP42gG2cGoa9uXcol9fCprarKysXCw==} engines: {node: '>=18.0.0'} peerDependencies: - '@azure-tools/typespec-azure-core': ~0.40.0 - '@azure-tools/typespec-client-generator-core': ~0.40.0 - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/openapi': ~0.54.0 - '@typespec/rest': ~0.54.0 - '@typespec/versioning': ~0.54.0 - dependencies: - '@azure-tools/typespec-azure-core': 0.40.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0) - '@azure-tools/typespec-client-generator-core': 0.40.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0) - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) - '@typespec/openapi': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) - '@typespec/rest': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) - '@typespec/versioning': 0.54.0(@typespec/compiler@0.54.0) - dev: true - - /@azure-tools/typespec-azure-core@0.40.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0): - resolution: {integrity: sha512-l5U47zXKYQKFbipRQLpjG4EwvPJg0SogdFEe5a3rRr7mUy8sWPkciHpngLZVOd2cKZQD5m7nqwfWL798I9TJnQ==} + '@azure-tools/typespec-azure-core': ~0.41.0 + '@azure-tools/typespec-client-generator-core': ~0.41.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/openapi': ~0.55.0 + '@typespec/rest': ~0.55.0 + '@typespec/versioning': ~0.55.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) + '@azure-tools/typespec-client-generator-core': 0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + dev: true + + /@azure-tools/typespec-azure-core@0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0): + resolution: {integrity: sha512-bnVrLxyjhMfKv75POL3m+lWjyqpLtWYEM9t2mrhFECHfW3+gWzTKIg98oNMKLXmev/sCc9QhbkKLs72jqxNL1Q==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/rest': ~0.54.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/rest': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) - '@typespec/rest': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) dev: true - /@azure-tools/typespec-azure-resource-manager@0.40.0(@azure-tools/typespec-autorest@0.40.0)(@azure-tools/typespec-azure-core@0.40.0)(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/openapi@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0): - resolution: {integrity: sha512-gjkpVe09ug6ctisbp9wY57G3KX2MuaasjQdU+knJ9lTc4IgUsuLNlP1TM/v0Jso1T5cWo5K/doqkxc+xUIWrvQ==} + /@azure-tools/typespec-azure-resource-manager@0.41.0(@azure-tools/typespec-autorest@0.41.0)(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): + resolution: {integrity: sha512-KPeQQle+hd508bkRjWHDsUXhoLjXVJg0DQyPM9wIxf+3cE0yH0aUxWPU6aj+aTio84226ExO2Qh8IadqgoQ5qg==} engines: {node: '>=18.0.0'} peerDependencies: - '@azure-tools/typespec-autorest': ~0.40.0 - '@azure-tools/typespec-azure-core': ~0.40.0 - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/openapi': ~0.54.0 - '@typespec/rest': ~0.54.0 - '@typespec/versioning': ~0.54.0 - dependencies: - '@azure-tools/typespec-autorest': 0.40.0(@azure-tools/typespec-azure-core@0.40.0)(@azure-tools/typespec-client-generator-core@0.40.0)(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/openapi@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0) - '@azure-tools/typespec-azure-core': 0.40.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0) - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) - '@typespec/openapi': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) - '@typespec/rest': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) - '@typespec/versioning': 0.54.0(@typespec/compiler@0.54.0) - dev: true - - /@azure-tools/typespec-client-generator-core@0.40.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/rest@0.54.0)(@typespec/versioning@0.54.0): - resolution: {integrity: sha512-Nm/OfDtSWBr1lylISbXR37B9QKWlZHK1j4T8L439Y1v3VcvJsC/0F5PLemY0odHpOYZNwu2uevJjAeM5W56wlw==} + '@azure-tools/typespec-autorest': ~0.41.0 + '@azure-tools/typespec-azure-core': ~0.41.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/openapi': ~0.55.0 + '@typespec/rest': ~0.55.0 + '@typespec/versioning': ~0.55.0 + dependencies: + '@azure-tools/typespec-autorest': 0.41.0(@azure-tools/typespec-azure-core@0.41.0)(@azure-tools/typespec-client-generator-core@0.41.1)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0) + '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) + dev: true + + /@azure-tools/typespec-client-generator-core@0.41.1(@azure-tools/typespec-azure-core@0.41.0)(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0)(@typespec/versioning@0.55.0): + resolution: {integrity: sha512-0eul/+2JEXVdN/wKL2wgCXuwiYJsnExe8v3AEkO+1SF6CP6iUj1yqwD6ypjZ9D8fmt7wAChCao4LYcOAsPXNdg==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 - '@typespec/rest': ~0.54.0 - '@typespec/versioning': ~0.54.0 - dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) - '@typespec/rest': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) - '@typespec/versioning': 0.54.0(@typespec/compiler@0.54.0) + '@azure-tools/typespec-azure-core': ~0.41.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 + '@typespec/rest': ~0.55.0 + '@typespec/versioning': ~0.55.0 + dependencies: + '@azure-tools/typespec-azure-core': 0.41.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/rest@0.55.0) + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/rest': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) change-case: 5.4.3 pluralize: 8.0.0 dev: true @@ -402,7 +404,14 @@ packages: resolution: {integrity: sha512-TrRLIoSQVzfAJX9H1JeFjzAoDGcoK1IYX1UImfceTZpsyYfWr09Ss1aHW1y5TrrR3iq6RZLBwJ3E24uwPhwahw==} engines: {node: '>=12.0.0'} dependencies: - tslib: 2.6.1 + tslib: 2.6.2 + dev: true + + /@azure/abort-controller@2.1.1: + resolution: {integrity: sha512-NhzeNm5zu2fPlwGXPUjzsRCRuPx5demaZyNcyNYJDqpa/Sbxzvo/RYt9IwUaAOnDW5+r7J9UOE6f22TQnb9nhQ==} + engines: {node: '>=18.0.0'} + dependencies: + tslib: 2.6.2 dev: true /@azure/core-auth@1.5.0: @@ -411,7 +420,16 @@ packages: dependencies: '@azure/abort-controller': 1.1.0 '@azure/core-util': 1.4.0 - tslib: 2.6.1 + tslib: 2.6.2 + dev: true + + /@azure/core-auth@1.7.1: + resolution: {integrity: sha512-dyeQwvgthqs/SlPVQbZQetpslXceHd4i5a7M/7z/lGEAVwnSluabnQOjF2/dk/hhWgMISusv1Ytp4mQ8JNy62A==} + engines: {node: '>=18.0.0'} + dependencies: + '@azure/abort-controller': 2.1.1 + '@azure/core-util': 1.8.1 + tslib: 2.6.2 dev: true /@azure/core-client@1.7.3: @@ -424,7 +442,22 @@ packages: '@azure/core-tracing': 1.0.1 '@azure/core-util': 1.4.0 '@azure/logger': 1.0.4 - tslib: 2.6.1 + tslib: 2.6.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@azure/core-client@1.9.1: + resolution: {integrity: sha512-hHYFx9lz0ZpbO5W+iotU9tmIX1jPcoIjYUEUaWGuMi1628LCQ/z05TUR4P+NRtMgyoHQuyVYyGQiD3PC47kaIA==} + engines: {node: '>=18.0.0'} + dependencies: + '@azure/abort-controller': 2.1.1 + '@azure/core-auth': 1.7.1 + '@azure/core-rest-pipeline': 1.15.1 + '@azure/core-tracing': 1.1.1 + '@azure/core-util': 1.8.1 + '@azure/logger': 1.1.1 + tslib: 2.6.2 transitivePeerDependencies: - supports-color dev: true @@ -443,7 +476,29 @@ packages: form-data: 4.0.0 node-fetch: 2.6.12 process: 0.11.10 - tslib: 2.6.1 + tslib: 2.6.2 + tunnel: 0.0.6 + uuid: 8.3.2 + xml2js: 0.5.0 + transitivePeerDependencies: + - encoding + dev: true + + /@azure/core-http@3.0.4: + resolution: {integrity: sha512-Fok9VVhMdxAFOtqiiAtg74fL0UJkt0z3D+ouUUxcRLzZNBioPRAMJFVxiWoJljYpXsRi4GDQHzQHDc9AiYaIUQ==} + engines: {node: '>=14.0.0'} + dependencies: + '@azure/abort-controller': 1.1.0 + '@azure/core-auth': 1.7.1 + '@azure/core-tracing': 1.0.0-preview.13 + '@azure/core-util': 1.8.1 + '@azure/logger': 1.1.1 + '@types/node-fetch': 2.6.11 + '@types/tunnel': 0.0.3 + form-data: 4.0.0 + node-fetch: 2.7.0 + process: 0.11.10 + tslib: 2.6.2 tunnel: 0.0.6 uuid: 8.3.2 xml2js: 0.5.0 @@ -458,14 +513,31 @@ packages: '@azure/abort-controller': 1.1.0 '@azure/core-util': 1.4.0 '@azure/logger': 1.0.4 - tslib: 2.6.1 + tslib: 2.6.2 + dev: true + + /@azure/core-lro@2.7.1: + resolution: {integrity: sha512-kXSlrNHOCTVZMxpXNRqzgh9/j4cnNXU5Hf2YjMyjddRhCXFiFRzmNaqwN+XO9rGTsCOIaaG7M67zZdyliXZG9g==} + engines: {node: '>=18.0.0'} + dependencies: + '@azure/abort-controller': 2.1.1 + '@azure/core-util': 1.8.1 + '@azure/logger': 1.1.1 + tslib: 2.6.2 dev: true /@azure/core-paging@1.5.0: resolution: {integrity: sha512-zqWdVIt+2Z+3wqxEOGzR5hXFZ8MGKK52x4vFLw8n58pR6ZfKRx3EXYTxTaYxYHc/PexPUTyimcTWFJbji9Z6Iw==} engines: {node: '>=14.0.0'} dependencies: - tslib: 2.6.1 + tslib: 2.6.2 + dev: true + + /@azure/core-paging@1.6.1: + resolution: {integrity: sha512-3tKIQXSU3mlN+ITz0m2pXLnKK3oQ6/EVcW8ud011Iq+M0rx6Wnm7NUEpoMeOAEedeKlPtemrQzO6YWoDR71O5w==} + engines: {node: '>=18.0.0'} + dependencies: + tslib: 2.6.2 dev: true /@azure/core-rest-pipeline@1.12.0: @@ -480,7 +552,23 @@ packages: form-data: 4.0.0 http-proxy-agent: 5.0.0 https-proxy-agent: 5.0.1 - tslib: 2.6.1 + tslib: 2.6.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@azure/core-rest-pipeline@1.15.1: + resolution: {integrity: sha512-ZxS6i3eHxh86u+1eWZJiYywoN2vxvsSoAUx60Mny8cZ4nTwvt7UzVVBJO+m2PW2KIJfNiXMt59xBa59htOWL4g==} + engines: {node: '>=18.0.0'} + dependencies: + '@azure/abort-controller': 2.1.1 + '@azure/core-auth': 1.7.1 + '@azure/core-tracing': 1.1.1 + '@azure/core-util': 1.8.1 + '@azure/logger': 1.1.1 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.4 + tslib: 2.6.2 transitivePeerDependencies: - supports-color dev: true @@ -490,14 +578,21 @@ packages: engines: {node: '>=12.0.0'} dependencies: '@opentelemetry/api': 1.4.1 - tslib: 2.6.1 + tslib: 2.6.2 dev: true /@azure/core-tracing@1.0.1: resolution: {integrity: sha512-I5CGMoLtX+pI17ZdiFJZgxMJApsK6jjfm85hpgp3oazCdq5Wxgh4wMr7ge/TTWW1B5WBuvIOI1fMU/FrOAMKrw==} engines: {node: '>=12.0.0'} dependencies: - tslib: 2.6.1 + tslib: 2.6.2 + dev: true + + /@azure/core-tracing@1.1.1: + resolution: {integrity: sha512-qPbYhN1pE5XQ2jPKIHP33x8l3oBu1UqIWnYqZZ3OYnYjzY0xqIHjn49C+ptsPD9yC7uyWI9Zm7iZUZLs2R4DhQ==} + engines: {node: '>=18.0.0'} + dependencies: + tslib: 2.6.2 dev: true /@azure/core-util@1.4.0: @@ -505,7 +600,15 @@ packages: engines: {node: '>=14.0.0'} dependencies: '@azure/abort-controller': 1.1.0 - tslib: 2.6.1 + tslib: 2.6.2 + dev: true + + /@azure/core-util@1.8.1: + resolution: {integrity: sha512-L3voj0StUdJ+YKomvwnTv7gHzguJO+a6h30pmmZdRprJCM+RJlGMPxzuh4R7lhQu1jNmEtaHX5wvTgWLDAmbGQ==} + engines: {node: '>=18.0.0'} + dependencies: + '@azure/abort-controller': 2.1.1 + tslib: 2.6.2 dev: true /@azure/identity@3.3.0: @@ -533,11 +636,40 @@ packages: - supports-color dev: true + /@azure/identity@3.4.2: + resolution: {integrity: sha512-0q5DL4uyR0EZ4RXQKD8MadGH6zTIcloUoS/RVbCpNpej4pwte0xpqYxk8K97Py2RiuUvI7F4GXpoT4046VfufA==} + engines: {node: '>=14.0.0'} + dependencies: + '@azure/abort-controller': 1.1.0 + '@azure/core-auth': 1.7.1 + '@azure/core-client': 1.9.1 + '@azure/core-rest-pipeline': 1.15.1 + '@azure/core-tracing': 1.1.1 + '@azure/core-util': 1.8.1 + '@azure/logger': 1.1.1 + '@azure/msal-browser': 3.11.1 + '@azure/msal-node': 2.6.6 + events: 3.3.0 + jws: 4.0.0 + open: 8.4.2 + stoppable: 1.1.0 + tslib: 2.6.2 + transitivePeerDependencies: + - supports-color + dev: true + /@azure/logger@1.0.4: resolution: {integrity: sha512-ustrPY8MryhloQj7OWGe+HrYx+aoiOxzbXTtgblbV3xwCqpzUK36phH3XNHQKj3EPonyFUuDTfR3qFhTEAuZEg==} engines: {node: '>=14.0.0'} dependencies: - tslib: 2.6.1 + tslib: 2.6.2 + + /@azure/logger@1.1.1: + resolution: {integrity: sha512-/+4TtokaGgC+MnThdf6HyIH9Wrjp+CnCn3Nx3ggevN7FFjjNyjqg0yLlc2i9S+Z2uAzI8GYOo35Nzb1MhQ89MA==} + engines: {node: '>=18.0.0'} + dependencies: + tslib: 2.6.2 + dev: true /@azure/msal-browser@2.38.1: resolution: {integrity: sha512-NROo7mLpw7aWtj8tWy9ZPz3WWiudwVAOIDZ1K3PPrjDAA4kFYayWlbZiJl1T1sD5Oqwa6FOtwzFSvuUj1CWp6Q==} @@ -547,11 +679,23 @@ packages: '@azure/msal-common': 13.2.1 dev: true + /@azure/msal-browser@3.11.1: + resolution: {integrity: sha512-tZFJnP5ZpgkmazSriEDW+Xl3/4WI823uhnYhWCHPkGywFWEZoPA5VkiCK8x4x8ECXp3mGr5qEI82MU43PBiaKA==} + engines: {node: '>=0.8.0'} + dependencies: + '@azure/msal-common': 14.8.1 + dev: true + /@azure/msal-common@13.2.1: resolution: {integrity: sha512-9CtyVdDtAOw+raemKg8gdBuE7gleObgSb7p4bzMIlUt8eM69/Gaow7uqr1gK3jLYINSrss32OZW8mBbdgVLiHg==} engines: {node: '>=0.8.0'} dev: true + /@azure/msal-common@14.8.1: + resolution: {integrity: sha512-9HfBMDTIgtFFkils+o6gO/aGEoLLuc4z+QLLfhy/T1bTNPiVsX/9CjaBPMZGnMltN/IlMkU5SGGNggGh55p5xA==} + engines: {node: '>=0.8.0'} + dev: true + /@azure/msal-node@1.18.1: resolution: {integrity: sha512-B4kUOWJoN4vD8b3pGJ9Q9mIZhaDb8EnQM1aN0x1otlQgTfzDvEk6rWc6fy8uGdtXqcNddBtiXdc4oRiItroVkA==} engines: {node: 10 || 12 || 14 || 16 || 18} @@ -562,6 +706,15 @@ packages: uuid: 8.3.2 dev: true + /@azure/msal-node@2.6.6: + resolution: {integrity: sha512-j+1hW81ccglIYWukXufzRA4O71BCmpbmCO66ECDyE9FuPno6SjiR+K+mIk4tg6aQ7/UO2QA/EnRmT6YN0EF1Hw==} + engines: {node: '>=16'} + dependencies: + '@azure/msal-common': 14.8.1 + jsonwebtoken: 9.0.2 + uuid: 8.3.2 + dev: true + /@azure/storage-blob@12.15.0: resolution: {integrity: sha512-e7JBKLOFi0QVJqqLzrjx1eL3je3/Ug2IQj24cTM9b85CsnnFjLGeGjJVIjbGGZaytewiCEG7r3lRwQX7fKj0/w==} engines: {node: '>=14.0.0'} @@ -573,42 +726,54 @@ packages: '@azure/core-tracing': 1.0.0-preview.13 '@azure/logger': 1.0.4 events: 3.3.0 - tslib: 2.6.1 + tslib: 2.6.2 transitivePeerDependencies: - encoding dev: true - /@babel/code-frame@7.22.13: - resolution: {integrity: sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==} - engines: {node: '>=6.9.0'} + /@azure/storage-blob@12.17.0: + resolution: {integrity: sha512-sM4vpsCpcCApagRW5UIjQNlNylo02my2opgp0Emi8x888hZUvJ3dN69Oq20cEGXkMUWnoCrBaB0zyS3yeB87sQ==} + engines: {node: '>=14.0.0'} dependencies: - '@babel/highlight': 7.23.4 - chalk: 2.4.2 + '@azure/abort-controller': 1.1.0 + '@azure/core-http': 3.0.4 + '@azure/core-lro': 2.7.1 + '@azure/core-paging': 1.6.1 + '@azure/core-tracing': 1.0.0-preview.13 + '@azure/logger': 1.1.1 + events: 3.3.0 + tslib: 2.6.2 + transitivePeerDependencies: + - encoding dev: true /@babel/code-frame@7.23.5: resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/highlight': 7.23.4 + '@babel/highlight': 7.24.2 chalk: 2.4.2 + dev: true - /@babel/helper-validator-identifier@7.22.20: - resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} + /@babel/code-frame@7.24.2: + resolution: {integrity: sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==} engines: {node: '>=6.9.0'} + dependencies: + '@babel/highlight': 7.24.2 + picocolors: 1.0.0 - /@babel/helper-validator-identifier@7.22.5: - resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==} + /@babel/helper-validator-identifier@7.22.20: + resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} - dev: true - /@babel/highlight@7.23.4: - resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} + /@babel/highlight@7.24.2: + resolution: {integrity: sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-validator-identifier': 7.22.20 chalk: 2.4.2 js-tokens: 4.0.0 + picocolors: 1.0.0 /@bcoe/v8-coverage@0.2.3: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} @@ -619,6 +784,11 @@ packages: engines: {node: '>=0.1.90'} dev: true + /@colors/colors@1.6.0: + resolution: {integrity: sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==} + engines: {node: '>=0.1.90'} + dev: true + /@dabh/diagnostics@2.0.3: resolution: {integrity: sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==} dependencies: @@ -637,16 +807,21 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.57.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.56.0 + eslint: 8.57.0 eslint-visitor-keys: 3.4.3 dev: true + /@eslint-community/regexpp@4.10.0: + resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + dev: true + /@eslint-community/regexpp@4.6.2: resolution: {integrity: sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} @@ -676,8 +851,8 @@ packages: ajv: 6.12.6 debug: 4.3.4(supports-color@8.1.1) espree: 9.6.1 - globals: 13.21.0 - ignore: 5.2.4 + globals: 13.24.0 + ignore: 5.3.1 import-fresh: 3.3.0 js-yaml: 4.1.0 minimatch: 3.1.2 @@ -691,8 +866,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@eslint/js@8.56.0: - resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==} + /@eslint/js@8.57.0: + resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true @@ -711,7 +886,7 @@ packages: resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} engines: {node: '>=10.10.0'} dependencies: - '@humanwhocodes/object-schema': 2.0.2 + '@humanwhocodes/object-schema': 2.0.3 debug: 4.3.4(supports-color@8.1.1) minimatch: 3.1.2 transitivePeerDependencies: @@ -727,8 +902,8 @@ packages: resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} dev: true - /@humanwhocodes/object-schema@2.0.2: - resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==} + /@humanwhocodes/object-schema@2.0.3: + resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} dev: true /@isaacs/cliui@8.0.2: @@ -830,12 +1005,12 @@ packages: engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} dev: true - /@rushstack/eslint-patch@1.7.2: - resolution: {integrity: sha512-RbhOOTCNoCrbfkRyoXODZp75MlpiHMgbE5MEBZAnnnLyQNgrigEj4p0lzsMDyc1zVsJDLrivB58tgg3emX0eEA==} + /@rushstack/eslint-patch@1.10.1: + resolution: {integrity: sha512-S3Kq8e7LqxkA9s7HKLqXGTGck1uwis5vAXan3FnU5yw1Ec5hsSGnq4s/UCaSqABPOnOTg7zASLyst7+ohgWexg==} dev: true - /@sindresorhus/merge-streams@1.0.0: - resolution: {integrity: sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==} + /@sindresorhus/merge-streams@2.3.0: + resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} engines: {node: '>=18'} /@tootallnate/once@2.0.0: @@ -851,6 +1026,10 @@ packages: resolution: {integrity: sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==} dev: true + /@types/js-yaml@4.0.9: + resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} + dev: true + /@types/json-schema@7.0.12: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} dev: true @@ -863,6 +1042,13 @@ packages: resolution: {integrity: sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==} dev: true + /@types/node-fetch@2.6.11: + resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} + dependencies: + '@types/node': 18.19.29 + form-data: 4.0.0 + dev: true + /@types/node-fetch@2.6.4: resolution: {integrity: sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==} dependencies: @@ -874,8 +1060,14 @@ packages: resolution: {integrity: sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==} dev: true - /@types/normalize-package-data@2.4.1: - resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} + /@types/node@18.19.29: + resolution: {integrity: sha512-5pAX7ggTmWZdhUrhRWLPf+5oM7F80bcKVCBbr0zwEkTNzTJL2CWQjznpFgHYy6GrzkYi2Yjy7DHKoynFxqPV8g==} + dependencies: + undici-types: 5.26.5 + dev: true + + /@types/normalize-package-data@2.4.4: + resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true /@types/semver@7.5.0: @@ -886,55 +1078,59 @@ packages: resolution: {integrity: sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==} dev: true + /@types/triple-beam@1.3.5: + resolution: {integrity: sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==} + dev: true + /@types/tunnel@0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: '@types/node': 18.16.3 dev: true - /@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/eslint-plugin@7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4): + resolution: {integrity: sha512-HpqNTH8Du34nLxbKgVMGljZMG0rJd2O9ecvr2QLYp+7512ty1j42KnsFwspPXg1Vh8an9YImf6CokUBltisZFQ==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha - eslint: ^7.0.0 || ^8.0.0 + '@typescript-eslint/parser': ^7.0.0 + eslint: ^8.56.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: '@eslint-community/regexpp': 4.6.2 - '@typescript-eslint/parser': 6.21.0(eslint@8.44.0)(typescript@5.1.3) - '@typescript-eslint/scope-manager': 6.21.0 - '@typescript-eslint/type-utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/visitor-keys': 6.21.0 + '@typescript-eslint/parser': 7.5.0(eslint@8.44.0)(typescript@5.1.3) + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/type-utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) + '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4(supports-color@8.1.1) - eslint: 8.56.0 + eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.2.4 natural-compare: 1.4.0 - semver: 7.5.4 - ts-api-utils: 1.0.1(typescript@5.3.3) - typescript: 5.3.3 + semver: 7.6.0 + ts-api-utils: 1.0.1(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@6.21.0(eslint@8.44.0)(typescript@5.1.3): - resolution: {integrity: sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/parser@7.5.0(eslint@8.44.0)(typescript@5.1.3): + resolution: {integrity: sha512-cj+XGhNujfD2/wzR1tabNsidnYRaFfEkcULdcIyVBYcXjBvBKOes+mpMBP7hMpOyk+gBcfXsrg4NBGAStQyxjQ==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - eslint: ^7.0.0 || ^8.0.0 + eslint: ^8.56.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 6.21.0 - '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.1.3) - '@typescript-eslint/visitor-keys': 6.21.0 + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.1.3) + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4(supports-color@8.1.1) eslint: 8.44.0 typescript: 5.1.3 @@ -942,14 +1138,6 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@6.19.1: - resolution: {integrity: sha512-4CdXYjKf6/6aKNMSly/BP4iCSOpvMmqtDzRtqFyyAae3z5kkqEjKndR5vDHL8rSuMIIWP8u4Mw4VxLyxZW6D5w==} - engines: {node: ^16.0.0 || >=18.0.0} - dependencies: - '@typescript-eslint/types': 6.19.1 - '@typescript-eslint/visitor-keys': 6.19.1 - dev: true - /@typescript-eslint/scope-manager@6.21.0: resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} engines: {node: ^16.0.0 || >=18.0.0} @@ -958,38 +1146,46 @@ packages: '@typescript-eslint/visitor-keys': 6.21.0 dev: true - /@typescript-eslint/type-utils@6.21.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/scope-manager@7.5.0: + resolution: {integrity: sha512-Z1r7uJY0MDeUlql9XJ6kRVgk/sP11sr3HKXn268HZyqL7i4cEfrdFuSSY/0tUqT37l5zT0tJOsuDP16kio85iA==} + engines: {node: ^18.18.0 || >=20.0.0} + dependencies: + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/visitor-keys': 7.5.0 + dev: true + + /@typescript-eslint/type-utils@7.5.0(eslint@8.57.0)(typescript@5.4.4): + resolution: {integrity: sha512-A021Rj33+G8mx2Dqh0nMO9GyjjIBK3MqgVgZ2qlKf6CJy51wY/lkkFqq3TqqnH34XyAHUkq27IjlUkWlQRpLHw==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - eslint: ^7.0.0 || ^8.0.0 + eslint: ^8.56.0 typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3) - '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) + '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) debug: 4.3.4(supports-color@8.1.1) - eslint: 8.56.0 - ts-api-utils: 1.0.1(typescript@5.3.3) - typescript: 5.3.3 + eslint: 8.57.0 + ts-api-utils: 1.0.1(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types@6.19.1: - resolution: {integrity: sha512-6+bk6FEtBhvfYvpHsDgAL3uo4BfvnTnoge5LrrCj2eJN8g3IJdLTD4B/jK3Q6vo4Ql/Hoip9I8aB6fF+6RfDqg==} - engines: {node: ^16.0.0 || >=18.0.0} - dev: true - /@typescript-eslint/types@6.21.0: resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@6.19.1(typescript@5.3.3): - resolution: {integrity: sha512-aFdAxuhzBFRWhy+H20nYu19+Km+gFfwNO4TEqyszkMcgBDYQjmPJ61erHxuT2ESJXhlhrO7I5EFIlZ+qGR8oVA==} + /@typescript-eslint/types@7.5.0: + resolution: {integrity: sha512-tv5B4IHeAdhR7uS4+bf8Ov3k793VEVHd45viRRkehIUZxm0WF82VPiLgHzA/Xl4TGPg1ZD49vfxBKFPecD5/mg==} + engines: {node: ^18.18.0 || >=20.0.0} + dev: true + + /@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.4): + resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' @@ -997,166 +1193,166 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.19.1 - '@typescript-eslint/visitor-keys': 6.19.1 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.1(typescript@5.3.3) - typescript: 5.3.3 + semver: 7.6.0 + ts-api-utils: 1.0.1(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/typescript-estree@6.21.0(typescript@5.1.3): - resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/typescript-estree@7.5.0(typescript@5.1.3): + resolution: {integrity: sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/visitor-keys': 6.21.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 - semver: 7.5.4 + semver: 7.6.0 ts-api-utils: 1.0.1(typescript@5.1.3) typescript: 5.1.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/typescript-estree@6.21.0(typescript@5.3.3): - resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/typescript-estree@7.5.0(typescript@5.4.4): + resolution: {integrity: sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/visitor-keys': 6.21.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.1(typescript@5.3.3) - typescript: 5.3.3 + semver: 7.6.0 + ts-api-utils: 1.0.1(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@6.19.1(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-JvjfEZuP5WoMqwh9SPAPDSHSg9FBHHGhjPugSRxu5jMfjvBpq5/sGTD+9M9aQ5sh6iJ8AY/Kk/oUYVEMAPwi7w==} + /@typescript-eslint/utils@6.21.0(eslint@8.57.0)(typescript@5.4.4): + resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@types/json-schema': 7.0.12 '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 6.19.1 - '@typescript-eslint/types': 6.19.1 - '@typescript-eslint/typescript-estree': 6.19.1(typescript@5.3.3) - eslint: 8.56.0 - semver: 7.5.4 + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.4) + eslint: 8.57.0 + semver: 7.6.0 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/utils@6.21.0(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/utils@7.5.0(eslint@8.57.0)(typescript@5.4.4): + resolution: {integrity: sha512-3vZl9u0R+/FLQcpy2EHyRGNqAS/ofJ3Ji8aebilfJe+fobK8+LbIFmrHciLVDxjDoONmufDcnVSF38KwMEOjzw==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - eslint: ^7.0.0 || ^8.0.0 + eslint: ^8.56.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@types/json-schema': 7.0.12 '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 6.21.0 - '@typescript-eslint/types': 6.21.0 - '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3) - eslint: 8.56.0 - semver: 7.5.4 + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) + eslint: 8.57.0 + semver: 7.6.0 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys@6.19.1: - resolution: {integrity: sha512-gkdtIO+xSO/SmI0W68DBg4u1KElmIUo3vXzgHyGPs6cxgB0sa3TlptRAAE0hUY1hM6FcDKEv7aIwiTGm76cXfQ==} + /@typescript-eslint/visitor-keys@6.21.0: + resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.19.1 + '@typescript-eslint/types': 6.21.0 eslint-visitor-keys: 3.4.3 dev: true - /@typescript-eslint/visitor-keys@6.21.0: - resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} - engines: {node: ^16.0.0 || >=18.0.0} + /@typescript-eslint/visitor-keys@7.5.0: + resolution: {integrity: sha512-mcuHM/QircmA6O7fy6nn2w/3ditQkj+SgtOc8DW3uQ10Yfj42amm2i+6F2K4YAOPNNTmE6iM1ynM6lrSwdendA==} + engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/types': 7.5.0 eslint-visitor-keys: 3.4.3 dev: true - /@typespec/compiler@0.51.0: - resolution: {integrity: sha512-eGxQG27ovSkmuAyUpYhQzTfENmMV1w/Zm1binmAT/gUF56SE+XGCg8pLaBNlDgRbcGDJaziiop7uBMDbsuBDyg==} + /@typespec/compiler@0.52.0: + resolution: {integrity: sha512-36cZ5RWxRjL4SUe41KjPh3j3RQibpUoOzHcSllQJ3ByTSZdXv1zckMHLiRfaAbTXUADSAn2GMs4ZO3s8GdOGIQ==} engines: {node: '>=18.0.0'} hasBin: true dependencies: - '@babel/code-frame': 7.22.13 + '@babel/code-frame': 7.23.5 ajv: 8.12.0 - change-case: 4.1.2 - globby: 13.2.2 + change-case: 5.3.0 + globby: 14.0.1 mustache: 4.2.0 picocolors: 1.0.0 prettier: 3.1.1 prompts: 2.4.2 - semver: 7.5.4 + semver: 7.6.0 vscode-languageserver: 9.0.1 - vscode-languageserver-textdocument: 1.0.8 + vscode-languageserver-textdocument: 1.0.11 yaml: 2.3.4 yargs: 17.7.2 dev: true - /@typespec/compiler@0.53.1: - resolution: {integrity: sha512-qneMDvZsLaL8+3PXzwXMAqgE4YtkUPPBg4oXrbreYa5NTccuvgVaO4cfya/SzG4WePUnmDTbbrP5aWd+VzYwYA==} + /@typespec/compiler@0.54.0: + resolution: {integrity: sha512-lxMqlvUq5m1KZUjg+IoM/gEwY+yeSjjnpUsz6wmzjK4cO9cIY4wPJdrZwe8jUc2UFOoqKXN3AK8N1UWxA+w9Dg==} engines: {node: '>=18.0.0'} hasBin: true dependencies: '@babel/code-frame': 7.23.5 ajv: 8.12.0 - change-case: 5.3.0 - globby: 14.0.0 + change-case: 5.4.3 + globby: 14.0.1 mustache: 4.2.0 picocolors: 1.0.0 - prettier: 3.1.1 + prettier: 3.2.5 prompts: 2.4.2 - semver: 7.5.4 + semver: 7.6.0 vscode-languageserver: 9.0.1 - vscode-languageserver-textdocument: 1.0.8 + vscode-languageserver-textdocument: 1.0.11 yaml: 2.3.4 yargs: 17.7.2 dev: true - /@typespec/compiler@0.54.0: - resolution: {integrity: sha512-lxMqlvUq5m1KZUjg+IoM/gEwY+yeSjjnpUsz6wmzjK4cO9cIY4wPJdrZwe8jUc2UFOoqKXN3AK8N1UWxA+w9Dg==} + /@typespec/compiler@0.55.0: + resolution: {integrity: sha512-JxBkP7fTc3yzDYZ+Ms+ZHYlL2Ym22oloLDl6107SGaShNJBdQlabgE0aV8WvYRRBYt8g0RNb+sDLEcjvahj6Gw==} engines: {node: '>=18.0.0'} hasBin: true dependencies: - '@babel/code-frame': 7.23.5 + '@babel/code-frame': 7.24.2 ajv: 8.12.0 change-case: 5.4.3 - globby: 14.0.0 + globby: 14.0.1 mustache: 4.2.0 picocolors: 1.0.0 prettier: 3.2.5 @@ -1164,22 +1360,22 @@ packages: semver: 7.6.0 vscode-languageserver: 9.0.1 vscode-languageserver-textdocument: 1.0.11 - yaml: 2.3.4 + yaml: 2.4.1 yargs: 17.7.2 - /@typespec/eslint-config-typespec@0.54.0(prettier@3.1.1): - resolution: {integrity: sha512-Ni9rxn9ODmptMDTKa+p72uqaqA/i6DqwLRG8XJL2DSBYxlIReURzry1LA1Vz8Z4sM0k89rCCptgaQq8YvyGXMA==} - dependencies: - '@rushstack/eslint-patch': 1.7.2 - '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/parser': 6.21.0(eslint@8.44.0)(typescript@5.1.3) - eslint: 8.56.0 - eslint-config-prettier: 9.1.0(eslint@8.56.0) - eslint-plugin-deprecation: 2.0.0(eslint@8.56.0)(typescript@5.3.3) - eslint-plugin-prettier: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.56.0)(prettier@3.1.1) - eslint-plugin-unicorn: 51.0.1(eslint@8.56.0) - eslint-plugin-vitest: 0.3.22(@typescript-eslint/eslint-plugin@6.21.0)(eslint@8.56.0)(typescript@5.3.3) - typescript: 5.3.3 + /@typespec/eslint-config-typespec@0.55.0(prettier@3.2.5): + resolution: {integrity: sha512-zZI2ERGdgM9T6neL+Qdht3z89elGI38h68vSYnq5KFR3J500llSJI0Yb5NnE1G2Y7pjmBrnYWhL7UoOaGpW42A==} + dependencies: + '@rushstack/eslint-patch': 1.10.1 + '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4) + '@typescript-eslint/parser': 7.5.0(eslint@8.44.0)(typescript@5.1.3) + eslint: 8.57.0 + eslint-config-prettier: 9.1.0(eslint@8.57.0) + eslint-plugin-deprecation: 2.0.0(eslint@8.57.0)(typescript@5.4.4) + eslint-plugin-prettier: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5) + eslint-plugin-unicorn: 51.0.1(eslint@8.57.0) + eslint-plugin-vitest: 0.4.1(@typescript-eslint/eslint-plugin@7.5.0)(eslint@8.57.0)(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - '@types/eslint' - prettier @@ -1187,33 +1383,33 @@ packages: - vitest dev: true - /@typespec/http@0.51.0(@typespec/compiler@0.51.0): - resolution: {integrity: sha512-9YtcIPzUP0ELf/ZFBfhgLCPIyERn+DrYJTtEtaWkcO+qEkdFxO5eahwgh1FPuS6iJrW6pUPBuAfGDOAH1+N/PQ==} + /@typespec/http@0.52.1(@typespec/compiler@0.52.0): + resolution: {integrity: sha512-2i7t6eSKi96F/zt1w0yJvhRhubYej0F9o8jDRhPA+TZI6SAxcv/Vyi+lkKnkOcu90HPH7b8T+YNizudb00BO6A==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.51.0 + '@typespec/compiler': ~0.52.0 dependencies: - '@typespec/compiler': 0.51.0 + '@typespec/compiler': 0.52.0 dev: true - /@typespec/http@0.53.0(@typespec/compiler@0.53.1): - resolution: {integrity: sha512-Hdwbxr6KgzmJdULbbcwWaSSrWlduuMuEVUVdlytxyo9K+aoUCcPl0thR5Ez2VRh02/IJl3xG4n5wXgOwWb3amA==} + /@typespec/http@0.54.0(@typespec/compiler@0.54.0): + resolution: {integrity: sha512-/hZd9pkjJh3ogOekyKzZnpVV2kXzxtWDiTt3Gekc6iHTGk/CE1JpRFts8xwXoI5d3FqYotfb4w5ztVw62WjOcA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.53.0 + '@typespec/compiler': ~0.54.0 dependencies: - '@typespec/compiler': 0.53.1 + '@typespec/compiler': 0.54.0 dev: true - /@typespec/http@0.54.0(@typespec/compiler@0.54.0): - resolution: {integrity: sha512-/hZd9pkjJh3ogOekyKzZnpVV2kXzxtWDiTt3Gekc6iHTGk/CE1JpRFts8xwXoI5d3FqYotfb4w5ztVw62WjOcA==} + /@typespec/http@0.55.0(@typespec/compiler@0.55.0): + resolution: {integrity: sha512-r30RWzMTJgbyRpdtZxezlvXI/nkAvgilX1OM+s3A039lGLA+JRukgvKIZ3LaNr3lNXHiqeWQDrIZNhqBnpW1zw==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 + '@typespec/compiler': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 + '@typespec/compiler': 0.55.0 - /@typespec/openapi3@0.53.2(@typespec/compiler@0.54.0)(@typespec/http@0.54.0)(@typespec/openapi@0.54.0)(@typespec/versioning@0.54.0): + /@typespec/openapi3@0.53.2(@typespec/compiler@0.55.0)(@typespec/http@0.55.0)(@typespec/openapi@0.55.0)(@typespec/versioning@0.55.0): resolution: {integrity: sha512-8uwU3iJbt+WN3WlT9VzC7DN8rzB727zr8BMwZ81XN1/sX8dOJB49F5UiK0L+ychvx15RZ96CvYPCFmmnsOeyCQ==} engines: {node: '>=18.0.0'} peerDependencies: @@ -1222,49 +1418,38 @@ packages: '@typespec/openapi': ~0.53.0 '@typespec/versioning': ~0.53.0 dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) - '@typespec/openapi': 0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0) - '@typespec/versioning': 0.54.0(@typespec/compiler@0.54.0) + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) + '@typespec/openapi': 0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0) + '@typespec/versioning': 0.55.0(@typespec/compiler@0.55.0) yaml: 2.3.4 dev: false - /@typespec/openapi@0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0): - resolution: {integrity: sha512-QJkwq3whcqKb29ScMD5IQzqvDmPQyLAubRl82Zj6kVMCqabRwegOX9aN+K0083nci65zt9rflZbv9bKY5GRy/A==} + /@typespec/openapi@0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0): + resolution: {integrity: sha512-5T4VuJSOGfMFSs+1dOl3U3BC6VhKAxSTBrwcQDIEEygnqCSbj/tMFDhNfzKYKARRDotgM8ESOrZU6XH5srVR7A==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 - '@typespec/http': ~0.54.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 - '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) /@typespec/prettier-plugin-typespec@0.51.0: resolution: {integrity: sha512-byj0Xw+lg6LDa8duSC1iEhGCwOxb1yr4A7/KNL/JzFKPSRgUD4WePba8wxZEeMcRR2LeWlIIm8zxpWG97jkk8g==} dependencies: - prettier: 3.1.0 - dev: true - - /@typespec/rest@0.51.0(@typespec/compiler@0.51.0)(@typespec/http@0.51.0): - resolution: {integrity: sha512-swigbWjdewmKg+DtHj/a2r8jyX810JYkcIcVHkqdnkCq6TqlyNP0VSSUM39BmXmkCHMUumlSm2cOMieESRfNlg==} - engines: {node: '>=18.0.0'} - peerDependencies: - '@typespec/compiler': ~0.51.0 - '@typespec/http': ~0.51.0 - dependencies: - '@typespec/compiler': 0.51.0 - '@typespec/http': 0.51.0(@typespec/compiler@0.51.0) + prettier: 3.1.1 dev: true - /@typespec/rest@0.53.0(@typespec/compiler@0.53.1)(@typespec/http@0.53.0): - resolution: {integrity: sha512-aA75Ol2pRvUjtRqQvFHmFG52pkeif3m+tboLAT00AekTxOPZ3rqQmlE12ne4QF8KjgHA6denqH4f/XyDoRJOJQ==} + /@typespec/rest@0.52.0(@typespec/compiler@0.52.0)(@typespec/http@0.52.1): + resolution: {integrity: sha512-dLsY0fS60IVaAt4eCRcvEqorX/miPVV33du3dETTYYmbHtfEbvBKgTj/m6OH4noey7oaihlvLz5kYyLv8Am7zA==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.53.0 - '@typespec/http': ~0.53.0 + '@typespec/compiler': ~0.52.0 + '@typespec/http': ~0.52.0 dependencies: - '@typespec/compiler': 0.53.1 - '@typespec/http': 0.53.0(@typespec/compiler@0.53.1) + '@typespec/compiler': 0.52.0 + '@typespec/http': 0.52.1(@typespec/compiler@0.52.0) dev: true /@typespec/rest@0.54.0(@typespec/compiler@0.54.0)(@typespec/http@0.54.0): @@ -1278,22 +1463,33 @@ packages: '@typespec/http': 0.54.0(@typespec/compiler@0.54.0) dev: true - /@typespec/versioning@0.51.0(@typespec/compiler@0.51.0): - resolution: {integrity: sha512-eja0epBhtmJRO+Jq0Zdb2eRcSTsU+uq/X0xgD5SM+KB97nxFtaRkOJYd59QBN+XysvkcfVRrLOGJjzcpNMa0cw==} + /@typespec/rest@0.55.0(@typespec/compiler@0.55.0)(@typespec/http@0.55.0): + resolution: {integrity: sha512-RPZnx5D4xdTNiP0l++9IA8mUhnegPxetbdJ5RaG/QX2fTyF/gQ7t6AHIgdq8DfYVXqukQI/iGytJ135ObftbtQ==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.51.0 + '@typespec/compiler': ~0.55.0 + '@typespec/http': ~0.55.0 dependencies: - '@typespec/compiler': 0.51.0 + '@typespec/compiler': 0.55.0 + '@typespec/http': 0.55.0(@typespec/compiler@0.55.0) dev: true - /@typespec/versioning@0.54.0(@typespec/compiler@0.54.0): - resolution: {integrity: sha512-IlGpveOJ0WBTbn3w8nfzgSNhJWNd0+H+bo1Ljrjpeb9SFQmS8bX2fDf0vqsHVl50XgvKIZxgOpEXN5TmuzNnRw==} + /@typespec/versioning@0.52.0(@typespec/compiler@0.52.0): + resolution: {integrity: sha512-Vr4WHaZiDOxJqRp8/u6X0R45E+rFKEprYmSZX0o5bzetj0cVjOIEbQZvDJCif1Uz0S3K0KKfqf/kYmdYWMJ7Dw==} engines: {node: '>=18.0.0'} peerDependencies: - '@typespec/compiler': ~0.54.0 + '@typespec/compiler': ~0.52.0 + dependencies: + '@typespec/compiler': 0.52.0 + dev: true + + /@typespec/versioning@0.55.0(@typespec/compiler@0.55.0): + resolution: {integrity: sha512-89LTgkA3IBLnaaM4D4qfsrcEU0g3gasE1MmkrQ2HG21fYX88zKbmR1cKWeUxQx9MIXFOH4cPC9KhA/uLknRVMQ==} + engines: {node: '>=18.0.0'} + peerDependencies: + '@typespec/compiler': ~0.55.0 dependencies: - '@typespec/compiler': 0.54.0 + '@typespec/compiler': 0.55.0 /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -1330,6 +1526,15 @@ packages: - supports-color dev: true + /agent-base@7.1.1: + resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} + engines: {node: '>= 14'} + dependencies: + debug: 4.3.4(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: true + /ajv@6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -1400,18 +1605,27 @@ packages: is-array-buffer: 3.0.2 dev: true + /array-buffer-byte-length@1.0.1: + resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + is-array-buffer: 3.0.4 + dev: true + /array-flatten@1.1.1: resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} dev: true - /array-includes@3.1.6: - resolution: {integrity: sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==} + /array-includes@3.1.8: + resolution: {integrity: sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.22.1 - get-intrinsic: 1.2.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-object-atoms: 1.0.0 + get-intrinsic: 1.2.4 is-string: 1.0.7 dev: true @@ -1420,36 +1634,50 @@ packages: engines: {node: '>=8'} dev: true - /array.prototype.flat@1.3.1: - resolution: {integrity: sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==} + /array.prototype.findlastindex@1.2.5: + resolution: {integrity: sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.22.1 - es-shim-unscopables: 1.0.0 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-errors: 1.3.0 + es-object-atoms: 1.0.0 + es-shim-unscopables: 1.0.2 dev: true - /array.prototype.flatmap@1.3.1: - resolution: {integrity: sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==} + /array.prototype.flat@1.3.2: + resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.22.1 - es-shim-unscopables: 1.0.0 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-shim-unscopables: 1.0.2 dev: true - /arraybuffer.prototype.slice@1.0.1: - resolution: {integrity: sha512-09x0ZWFEjj4WD8PDbykUwo3t9arLn8NIzmmYEJFpYekOAQjpkGSyrQhNoRTcwwcFRu+ycWF78QZ63oWTqSjBcw==} + /array.prototype.flatmap@1.3.2: + resolution: {integrity: sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==} engines: {node: '>= 0.4'} dependencies: - array-buffer-byte-length: 1.0.0 - call-bind: 1.0.2 - define-properties: 1.2.0 - get-intrinsic: 1.2.1 - is-array-buffer: 3.0.2 - is-shared-array-buffer: 1.0.2 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-shim-unscopables: 1.0.2 + dev: true + + /arraybuffer.prototype.slice@1.0.3: + resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 + is-array-buffer: 3.0.4 + is-shared-array-buffer: 1.0.3 dev: true /asn1@0.2.6: @@ -1467,6 +1695,10 @@ packages: resolution: {integrity: sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==} dev: true + /async@3.2.5: + resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==} + dev: true + /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} dev: true @@ -1483,6 +1715,13 @@ packages: engines: {node: '>= 0.4'} dev: true + /available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + dependencies: + possible-typed-array-names: 1.0.0 + dev: true + /aws-sign2@0.7.0: resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==} dev: true @@ -1646,18 +1885,22 @@ packages: get-intrinsic: 1.2.1 dev: true + /call-bind@1.0.7: + resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} + engines: {node: '>= 0.4'} + dependencies: + es-define-property: 1.0.0 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.4 + set-function-length: 1.2.2 + dev: true + /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} dev: true - /camel-case@4.1.2: - resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==} - dependencies: - pascal-case: 3.1.2 - tslib: 2.6.1 - dev: true - /camelcase@6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} @@ -1667,14 +1910,6 @@ packages: resolution: {integrity: sha512-VblSX6nYqyJVs8DKFMldE2IVCJjZ225LW00ydtUWwh5hk9IfkTOffO6r8gJNsH0qqqeAF8KrbMYA2VEwTlGW5g==} dev: true - /capital-case@1.0.4: - resolution: {integrity: sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==} - dependencies: - no-case: 3.0.4 - tslib: 2.6.1 - upper-case-first: 2.0.2 - dev: true - /caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} dev: true @@ -1695,23 +1930,6 @@ packages: supports-color: 7.2.0 dev: true - /change-case@4.1.2: - resolution: {integrity: sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==} - dependencies: - camel-case: 4.1.2 - capital-case: 1.0.4 - constant-case: 3.0.4 - dot-case: 3.0.4 - header-case: 2.0.4 - no-case: 3.0.4 - param-case: 3.0.4 - pascal-case: 3.1.2 - path-case: 3.0.4 - sentence-case: 3.0.4 - snake-case: 3.0.4 - tslib: 2.6.1 - dev: true - /change-case@5.3.0: resolution: {integrity: sha512-Eykca0fGS/xYlx2fG5NqnGSnsWauhSGiSXYhB1kO6E909GUfo8S54u4UZNS7lMJmgZumZ2SUpWaoLgAcfQRICg==} dev: true @@ -1731,11 +1949,11 @@ packages: normalize-path: 3.0.0 readdirp: 3.6.0 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true - /ci-info@3.8.0: - resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==} + /ci-info@3.9.0: + resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} dev: true @@ -1845,14 +2063,6 @@ packages: typedarray: 0.0.6 dev: true - /constant-case@3.0.4: - resolution: {integrity: sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==} - dependencies: - no-case: 3.0.4 - tslib: 2.6.1 - upper-case: 2.0.2 - dev: true - /content-disposition@0.5.4: resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} engines: {node: '>= 0.6'} @@ -1878,6 +2088,11 @@ packages: engines: {node: '>= 0.6'} dev: true + /cookie@0.6.0: + resolution: {integrity: sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==} + engines: {node: '>= 0.6'} + dev: true + /core-js-compat@3.36.0: resolution: {integrity: sha512-iV9Pd/PsgjNWBXeq8XRtWVSgz2tKAfhfvBs7qxYty+RlRd+OCksaWmOnc4JKrTc1cToXL1N0s3l/vwlxPtdElw==} dependencies: @@ -1919,6 +2134,33 @@ packages: engines: {node: '>= 12'} dev: true + /data-view-buffer@1.0.1: + resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-data-view: 1.0.1 + dev: true + + /data-view-byte-length@1.0.1: + resolution: {integrity: sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-data-view: 1.0.1 + dev: true + + /data-view-byte-offset@1.0.0: + resolution: {integrity: sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + is-data-view: 1.0.1 + dev: true + /debug@2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} peerDependencies: @@ -1982,10 +2224,43 @@ packages: which-typed-array: 1.1.11 dev: true + /deep-equal@2.2.3: + resolution: {integrity: sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.1 + call-bind: 1.0.7 + es-get-iterator: 1.1.3 + get-intrinsic: 1.2.4 + is-arguments: 1.1.1 + is-array-buffer: 3.0.4 + is-date-object: 1.0.5 + is-regex: 1.1.4 + is-shared-array-buffer: 1.0.3 + isarray: 2.0.5 + object-is: 1.1.6 + object-keys: 1.1.1 + object.assign: 4.1.5 + regexp.prototype.flags: 1.5.2 + side-channel: 1.0.6 + which-boxed-primitive: 1.0.2 + which-collection: 1.0.2 + which-typed-array: 1.1.15 + dev: true + /deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} dev: true + /define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + dependencies: + es-define-property: 1.0.0 + es-errors: 1.3.0 + gopd: 1.0.1 + dev: true + /define-lazy-prop@2.0.0: resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} engines: {node: '>=8'} @@ -1999,6 +2274,15 @@ packages: object-keys: 1.1.1 dev: true + /define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.4 + has-property-descriptors: 1.0.2 + object-keys: 1.1.1 + dev: true + /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} @@ -2040,13 +2324,6 @@ packages: esutils: 2.0.3 dev: true - /dot-case@3.0.4: - resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} - dependencies: - no-case: 3.0.4 - tslib: 2.6.1 - dev: true - /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true @@ -2098,49 +2375,68 @@ packages: is-arrayish: 0.2.1 dev: true - /es-abstract@1.22.1: - resolution: {integrity: sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw==} + /es-abstract@1.23.3: + resolution: {integrity: sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==} engines: {node: '>= 0.4'} dependencies: - array-buffer-byte-length: 1.0.0 - arraybuffer.prototype.slice: 1.0.1 - available-typed-arrays: 1.0.5 - call-bind: 1.0.2 - es-set-tostringtag: 2.0.1 + array-buffer-byte-length: 1.0.1 + arraybuffer.prototype.slice: 1.0.3 + available-typed-arrays: 1.0.7 + call-bind: 1.0.7 + data-view-buffer: 1.0.1 + data-view-byte-length: 1.0.1 + data-view-byte-offset: 1.0.0 + es-define-property: 1.0.0 + es-errors: 1.3.0 + es-object-atoms: 1.0.0 + es-set-tostringtag: 2.0.3 es-to-primitive: 1.2.1 - function.prototype.name: 1.1.5 - get-intrinsic: 1.2.1 - get-symbol-description: 1.0.0 + function.prototype.name: 1.1.6 + get-intrinsic: 1.2.4 + get-symbol-description: 1.0.2 globalthis: 1.0.3 gopd: 1.0.1 - has: 1.0.3 - has-property-descriptors: 1.0.0 - has-proto: 1.0.1 + has-property-descriptors: 1.0.2 + has-proto: 1.0.3 has-symbols: 1.0.3 - internal-slot: 1.0.5 - is-array-buffer: 3.0.2 + hasown: 2.0.2 + internal-slot: 1.0.7 + is-array-buffer: 3.0.4 is-callable: 1.2.7 - is-negative-zero: 2.0.2 + is-data-view: 1.0.1 + is-negative-zero: 2.0.3 is-regex: 1.1.4 - is-shared-array-buffer: 1.0.2 + is-shared-array-buffer: 1.0.3 is-string: 1.0.7 - is-typed-array: 1.1.12 + is-typed-array: 1.1.13 is-weakref: 1.0.2 - object-inspect: 1.12.3 + object-inspect: 1.13.1 object-keys: 1.1.1 - object.assign: 4.1.4 - regexp.prototype.flags: 1.5.0 - safe-array-concat: 1.0.0 - safe-regex-test: 1.0.0 - string.prototype.trim: 1.2.7 - string.prototype.trimend: 1.0.6 - string.prototype.trimstart: 1.0.6 - typed-array-buffer: 1.0.0 - typed-array-byte-length: 1.0.0 - typed-array-byte-offset: 1.0.0 - typed-array-length: 1.0.4 + object.assign: 4.1.5 + regexp.prototype.flags: 1.5.2 + safe-array-concat: 1.1.2 + safe-regex-test: 1.0.3 + string.prototype.trim: 1.2.9 + string.prototype.trimend: 1.0.8 + string.prototype.trimstart: 1.0.8 + typed-array-buffer: 1.0.2 + typed-array-byte-length: 1.0.1 + typed-array-byte-offset: 1.0.2 + typed-array-length: 1.0.6 unbox-primitive: 1.0.2 - which-typed-array: 1.1.11 + which-typed-array: 1.1.15 + dev: true + + /es-define-property@1.0.0: + resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.4 + dev: true + + /es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} dev: true /es-get-iterator@1.1.3: @@ -2157,19 +2453,26 @@ packages: stop-iteration-iterator: 1.0.0 dev: true - /es-set-tostringtag@2.0.1: - resolution: {integrity: sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==} + /es-object-atoms@1.0.0: + resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} engines: {node: '>= 0.4'} dependencies: - get-intrinsic: 1.2.1 - has: 1.0.3 - has-tostringtag: 1.0.0 + es-errors: 1.3.0 + dev: true + + /es-set-tostringtag@2.0.3: + resolution: {integrity: sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.4 + has-tostringtag: 1.0.2 + hasown: 2.0.2 dev: true - /es-shim-unscopables@1.0.0: - resolution: {integrity: sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==} + /es-shim-unscopables@1.0.2: + resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} dependencies: - has: 1.0.3 + hasown: 2.0.2 dev: true /es-to-primitive@1.2.1: @@ -2198,27 +2501,27 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier@9.1.0(eslint@8.56.0): + /eslint-config-prettier@9.1.0(eslint@8.57.0): resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.56.0 + eslint: 8.57.0 dev: true /eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: debug: 3.2.7 - is-core-module: 2.13.0 - resolve: 1.22.4 + is-core-module: 2.13.1 + resolve: 1.22.8 transitivePeerDependencies: - supports-color dev: true - /eslint-module-utils@2.8.0(eslint-import-resolver-node@0.3.9)(eslint@8.44.0): - resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} + /eslint-module-utils@2.8.1(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + resolution: {integrity: sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==} engines: {node: '>=4'} peerDependencies: '@typescript-eslint/parser': '*' @@ -2239,29 +2542,29 @@ packages: optional: true dependencies: debug: 3.2.7 - eslint: 8.44.0 + eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-deprecation@2.0.0(eslint@8.56.0)(typescript@5.3.3): + /eslint-plugin-deprecation@2.0.0(eslint@8.57.0)(typescript@5.4.4): resolution: {integrity: sha512-OAm9Ohzbj11/ZFyICyR5N6LbOIvQMp7ZU2zI7Ej0jIc8kiGUERXPNMfw2QqqHD1ZHtjMub3yPZILovYEYucgoQ==} peerDependencies: eslint: ^7.0.0 || ^8.0.0 typescript: ^4.2.4 || ^5.0.0 dependencies: - '@typescript-eslint/utils': 6.19.1(eslint@8.56.0)(typescript@5.3.3) - eslint: 8.56.0 - tslib: 2.6.1 - tsutils: 3.21.0(typescript@5.3.3) - typescript: 5.3.3 + '@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.4.4) + eslint: 8.57.0 + tslib: 2.6.2 + tsutils: 3.21.0(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-import@2.27.5(eslint@8.44.0): - resolution: {integrity: sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==} + /eslint-plugin-import@2.29.1(eslint@8.57.0): + resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: '@typescript-eslint/parser': '*' @@ -2270,29 +2573,31 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - array-includes: 3.1.6 - array.prototype.flat: 1.3.1 - array.prototype.flatmap: 1.3.1 + array-includes: 3.1.8 + array.prototype.findlastindex: 1.2.5 + array.prototype.flat: 1.3.2 + array.prototype.flatmap: 1.3.2 debug: 3.2.7 doctrine: 2.1.0 - eslint: 8.44.0 + eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(eslint-import-resolver-node@0.3.9)(eslint@8.44.0) - has: 1.0.3 - is-core-module: 2.13.0 + eslint-module-utils: 2.8.1(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) + hasown: 2.0.2 + is-core-module: 2.13.1 is-glob: 4.0.3 minimatch: 3.1.2 - object.values: 1.1.6 - resolve: 1.22.4 + object.fromentries: 2.0.8 + object.groupby: 1.0.3 + object.values: 1.2.0 semver: 6.3.1 - tsconfig-paths: 3.14.2 + tsconfig-paths: 3.15.0 transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack - supports-color dev: true - /eslint-plugin-prettier@5.1.3(eslint-config-prettier@9.1.0)(eslint@8.56.0)(prettier@3.1.1): + /eslint-plugin-prettier@5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5): resolution: {integrity: sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -2306,24 +2611,24 @@ packages: eslint-config-prettier: optional: true dependencies: - eslint: 8.56.0 - eslint-config-prettier: 9.1.0(eslint@8.56.0) - prettier: 3.1.1 + eslint: 8.57.0 + eslint-config-prettier: 9.1.0(eslint@8.57.0) + prettier: 3.2.5 prettier-linter-helpers: 1.0.0 synckit: 0.8.8 dev: true - /eslint-plugin-unicorn@46.0.0(eslint@8.44.0): - resolution: {integrity: sha512-j07WkC+PFZwk8J33LYp6JMoHa1lXc1u6R45pbSAipjpfpb7KIGr17VE2D685zCxR5VL4cjrl65kTJflziQWMDA==} + /eslint-plugin-unicorn@46.0.1(eslint@8.57.0): + resolution: {integrity: sha512-setGhMTiLAddg1asdwjZ3hekIN5zLznNa5zll7pBPwFOka6greCKDQydfqy4fqyUhndi74wpDzClSQMEcmOaew==} engines: {node: '>=14.18'} peerDependencies: eslint: '>=8.28.0' dependencies: - '@babel/helper-validator-identifier': 7.22.5 - '@eslint-community/eslint-utils': 4.4.0(eslint@8.44.0) - ci-info: 3.8.0 + '@babel/helper-validator-identifier': 7.22.20 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + ci-info: 3.9.0 clean-regexp: 1.0.0 - eslint: 8.44.0 + eslint: 8.57.0 esquery: 1.5.0 indent-string: 4.0.0 is-builtin-module: 3.2.1 @@ -2334,23 +2639,23 @@ packages: regexp-tree: 0.1.27 regjsparser: 0.9.1 safe-regex: 2.1.1 - semver: 7.5.4 + semver: 7.6.0 strip-indent: 3.0.0 dev: true - /eslint-plugin-unicorn@51.0.1(eslint@8.56.0): + /eslint-plugin-unicorn@51.0.1(eslint@8.57.0): resolution: {integrity: sha512-MuR/+9VuB0fydoI0nIn2RDA5WISRn4AsJyNSaNKLVwie9/ONvQhxOBbkfSICBPnzKrB77Fh6CZZXjgTt/4Latw==} engines: {node: '>=16'} peerDependencies: eslint: '>=8.56.0' dependencies: '@babel/helper-validator-identifier': 7.22.20 - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@eslint/eslintrc': 2.1.4 ci-info: 4.0.0 clean-regexp: 1.0.0 core-js-compat: 3.36.0 - eslint: 8.56.0 + eslint: 8.57.0 esquery: 1.5.0 indent-string: 4.0.0 is-builtin-module: 3.2.1 @@ -2359,14 +2664,14 @@ packages: read-pkg-up: 7.0.1 regexp-tree: 0.1.27 regjsparser: 0.10.0 - semver: 7.5.4 + semver: 7.6.0 strip-indent: 3.0.0 transitivePeerDependencies: - supports-color dev: true - /eslint-plugin-vitest@0.3.22(@typescript-eslint/eslint-plugin@6.21.0)(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-atkFGQ7aVgcuSeSMDqnyevIyUpfBPMnosksgEPrKE7Y8xQlqG/5z2IQ6UDau05zXaaFv7Iz8uzqvIuKshjZ0Zw==} + /eslint-plugin-vitest@0.4.1(@typescript-eslint/eslint-plugin@7.5.0)(eslint@8.57.0)(typescript@5.4.4): + resolution: {integrity: sha512-+PnZ2u/BS+f5FiuHXz4zKsHPcMKHie+K+1Uvu/x91ovkCMEOJqEI8E9Tw1Wzx2QRz4MHOBHYf1ypO8N1K0aNAA==} engines: {node: ^18.0.0 || >= 20.0.0} peerDependencies: '@typescript-eslint/eslint-plugin': '*' @@ -2378,9 +2683,9 @@ packages: vitest: optional: true dependencies: - '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.56.0)(typescript@5.3.3) - '@typescript-eslint/utils': 6.21.0(eslint@8.56.0)(typescript@5.3.3) - eslint: 8.56.0 + '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.4) + '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.4) + eslint: 8.57.0 transitivePeerDependencies: - supports-color - typescript @@ -2447,15 +2752,15 @@ packages: - supports-color dev: true - /eslint@8.56.0: - resolution: {integrity: sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==} + /eslint@8.57.0: + resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) - '@eslint-community/regexpp': 4.6.2 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@eslint-community/regexpp': 4.10.0 '@eslint/eslintrc': 2.1.4 - '@eslint/js': 8.56.0 + '@eslint/js': 8.57.0 '@humanwhocodes/config-array': 0.11.14 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 @@ -2475,9 +2780,9 @@ packages: file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.21.0 + globals: 13.24.0 graphemer: 1.4.0 - ignore: 5.2.4 + ignore: 5.3.1 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 @@ -2553,6 +2858,22 @@ packages: methods: 1.1.2 dev: true + /express-promise-router@4.1.1(express@4.19.2): + resolution: {integrity: sha512-Lkvcy/ZGrBhzkl3y7uYBHLMtLI4D6XQ2kiFg9dq7fbktBch5gjqJ0+KovX0cvCAvTJw92raWunRLM/OM+5l4fA==} + engines: {node: '>=10'} + peerDependencies: + '@types/express': ^4.0.0 + express: ^4.0.0 + peerDependenciesMeta: + '@types/express': + optional: true + dependencies: + express: 4.19.2 + is-promise: 4.0.0 + lodash.flattendeep: 4.4.0 + methods: 1.1.2 + dev: true + /express@4.18.2: resolution: {integrity: sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==} engines: {node: '>= 0.10.0'} @@ -2592,6 +2913,45 @@ packages: - supports-color dev: true + /express@4.19.2: + resolution: {integrity: sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==} + engines: {node: '>= 0.10.0'} + dependencies: + accepts: 1.3.8 + array-flatten: 1.1.1 + body-parser: 1.20.2 + content-disposition: 0.5.4 + content-type: 1.0.5 + cookie: 0.6.0 + cookie-signature: 1.0.6 + debug: 2.6.9 + depd: 2.0.0 + encodeurl: 1.0.2 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 1.2.0 + fresh: 0.5.2 + http-errors: 2.0.0 + merge-descriptors: 1.0.1 + methods: 1.1.2 + on-finished: 2.4.1 + parseurl: 1.3.3 + path-to-regexp: 0.1.7 + proxy-addr: 2.0.7 + qs: 6.11.0 + range-parser: 1.2.1 + safe-buffer: 5.2.1 + send: 0.18.0 + serve-static: 1.15.0 + setprototypeof: 1.2.0 + statuses: 2.0.1 + type-is: 1.6.18 + utils-merge: 1.0.1 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + dev: true + /extend@3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} dev: true @@ -2794,15 +3154,15 @@ packages: dependencies: graceful-fs: 4.2.11 jsonfile: 6.1.0 - universalify: 2.0.0 + universalify: 2.0.1 dev: true /fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true @@ -2813,13 +3173,17 @@ packages: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} dev: true - /function.prototype.name@1.1.5: - resolution: {integrity: sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==} + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true + + /function.prototype.name@1.1.6: + resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.22.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 functions-have-names: 1.2.3 dev: true @@ -2840,12 +3204,24 @@ packages: has-symbols: 1.0.3 dev: true - /get-symbol-description@1.0.0: - resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} + /get-intrinsic@1.2.4: + resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.2.1 + es-errors: 1.3.0 + function-bind: 1.1.2 + has-proto: 1.0.3 + has-symbols: 1.0.3 + hasown: 2.0.2 + dev: true + + /get-symbol-description@1.0.2: + resolution: {integrity: sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 dev: true /getpass@0.1.7: @@ -2867,6 +3243,18 @@ packages: is-glob: 4.0.3 dev: true + /glob@10.3.12: + resolution: {integrity: sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==} + engines: {node: '>=16 || 14 >=14.17'} + hasBin: true + dependencies: + foreground-child: 3.1.1 + jackspeak: 2.3.6 + minimatch: 9.0.4 + minipass: 7.0.4 + path-scurry: 1.10.2 + dev: true + /glob@10.3.3: resolution: {integrity: sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==} engines: {node: '>=16 || 14 >=14.17'} @@ -2919,11 +3307,18 @@ packages: type-fest: 0.20.2 dev: true + /globals@13.24.0: + resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} + engines: {node: '>=8'} + dependencies: + type-fest: 0.20.2 + dev: true + /globalthis@1.0.3: resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} engines: {node: '>= 0.4'} dependencies: - define-properties: 1.2.0 + define-properties: 1.2.1 dev: true /globby@11.1.0: @@ -2938,22 +3333,11 @@ packages: slash: 3.0.0 dev: true - /globby@13.2.2: - resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - dir-glob: 3.0.1 - fast-glob: 3.3.2 - ignore: 5.2.4 - merge2: 1.4.1 - slash: 4.0.0 - dev: true - - /globby@14.0.0: - resolution: {integrity: sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==} + /globby@14.0.1: + resolution: {integrity: sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==} engines: {node: '>=18'} dependencies: - '@sindresorhus/merge-streams': 1.0.0 + '@sindresorhus/merge-streams': 2.3.0 fast-glob: 3.3.2 ignore: 5.2.4 path-type: 5.0.0 @@ -3007,11 +3391,22 @@ packages: get-intrinsic: 1.2.1 dev: true + /has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + dependencies: + es-define-property: 1.0.0 + dev: true + /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} dev: true + /has-proto@1.0.3: + resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} + engines: {node: '>= 0.4'} + dev: true + /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} @@ -3024,6 +3419,13 @@ packages: has-symbols: 1.0.3 dev: true + /has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + /has@1.0.3: resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} engines: {node: '>= 0.4.0'} @@ -3031,18 +3433,18 @@ packages: function-bind: 1.1.1 dev: true + /hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + dev: true + /he@1.2.0: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true dev: true - /header-case@2.0.4: - resolution: {integrity: sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==} - dependencies: - capital-case: 1.0.4 - tslib: 2.6.1 - dev: true - /hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} dev: true @@ -3073,6 +3475,16 @@ packages: - supports-color dev: true + /http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.1 + debug: 4.3.4(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: true + /http-signature@1.2.0: resolution: {integrity: sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==} engines: {node: '>=0.8', npm: '>=1.3.7'} @@ -3092,6 +3504,16 @@ packages: - supports-color dev: true + /https-proxy-agent@7.0.4: + resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.1 + debug: 4.3.4(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: true + /iconv-lite@0.4.24: resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} engines: {node: '>=0.10.0'} @@ -3103,6 +3525,11 @@ packages: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} + /ignore@5.3.1: + resolution: {integrity: sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==} + engines: {node: '>= 4'} + dev: true + /import-fresh@3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} @@ -3141,6 +3568,15 @@ packages: side-channel: 1.0.4 dev: true + /internal-slot@1.0.7: + resolution: {integrity: sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==} + engines: {node: '>= 0.4'} + dependencies: + es-errors: 1.3.0 + hasown: 2.0.2 + side-channel: 1.0.6 + dev: true + /ipaddr.js@1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} @@ -3162,6 +3598,14 @@ packages: is-typed-array: 1.1.12 dev: true + /is-array-buffer@3.0.4: + resolution: {integrity: sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + get-intrinsic: 1.2.4 + dev: true + /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} dev: true @@ -3203,10 +3647,17 @@ packages: engines: {node: '>= 0.4'} dev: true - /is-core-module@2.13.0: - resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==} + /is-core-module@2.13.1: + resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} dependencies: - has: 1.0.3 + hasown: 2.0.2 + dev: true + + /is-data-view@1.0.1: + resolution: {integrity: sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==} + engines: {node: '>= 0.4'} + dependencies: + is-typed-array: 1.1.13 dev: true /is-date-object@1.0.5: @@ -3240,8 +3691,13 @@ packages: resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} dev: true - /is-negative-zero@2.0.2: - resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} + /is-map@2.0.3: + resolution: {integrity: sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==} + engines: {node: '>= 0.4'} + dev: true + + /is-negative-zero@2.0.3: + resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==} engines: {node: '>= 0.4'} dev: true @@ -3282,12 +3738,24 @@ packages: resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==} dev: true + /is-set@2.0.3: + resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} + engines: {node: '>= 0.4'} + dev: true + /is-shared-array-buffer@1.0.2: resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} dependencies: call-bind: 1.0.2 dev: true + /is-shared-array-buffer@1.0.3: + resolution: {integrity: sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + dev: true + /is-stream@2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} @@ -3314,6 +3782,13 @@ packages: which-typed-array: 1.1.11 dev: true + /is-typed-array@1.1.13: + resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==} + engines: {node: '>= 0.4'} + dependencies: + which-typed-array: 1.1.15 + dev: true + /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} dev: true @@ -3327,10 +3802,15 @@ packages: resolution: {integrity: sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==} dev: true + /is-weakmap@2.0.2: + resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==} + engines: {node: '>= 0.4'} + dev: true + /is-weakref@1.0.2: resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 dev: true /is-weakset@2.0.2: @@ -3340,6 +3820,14 @@ packages: get-intrinsic: 1.2.1 dev: true + /is-weakset@2.0.3: + resolution: {integrity: sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + get-intrinsic: 1.2.4 + dev: true + /is-wsl@2.2.0: resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} engines: {node: '>=8'} @@ -3403,6 +3891,15 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true + /jackspeak@2.3.6: + resolution: {integrity: sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==} + engines: {node: '>=14'} + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: true + /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -3460,7 +3957,7 @@ packages: /jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} dependencies: - universalify: 2.0.0 + universalify: 2.0.1 optionalDependencies: graceful-fs: 4.2.11 dev: true @@ -3472,7 +3969,23 @@ packages: jws: 3.2.2 lodash: 4.17.21 ms: 2.1.3 - semver: 7.5.4 + semver: 7.6.0 + dev: true + + /jsonwebtoken@9.0.2: + resolution: {integrity: sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==} + engines: {node: '>=12', npm: '>=6'} + dependencies: + jws: 3.2.2 + lodash.includes: 4.3.0 + lodash.isboolean: 3.0.3 + lodash.isinteger: 4.0.4 + lodash.isnumber: 3.0.3 + lodash.isplainobject: 4.0.6 + lodash.isstring: 4.0.1 + lodash.once: 4.1.1 + ms: 2.1.3 + semver: 7.6.0 dev: true /jsprim@1.4.2: @@ -3553,10 +4066,38 @@ packages: resolution: {integrity: sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==} dev: true + /lodash.includes@4.3.0: + resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} + dev: true + + /lodash.isboolean@3.0.3: + resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==} + dev: true + + /lodash.isinteger@4.0.4: + resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==} + dev: true + + /lodash.isnumber@3.0.3: + resolution: {integrity: sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==} + dev: true + + /lodash.isplainobject@4.0.6: + resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} + dev: true + + /lodash.isstring@4.0.1: + resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==} + dev: true + /lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true + /lodash.once@4.1.1: + resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==} + dev: true + /lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} dev: true @@ -3580,10 +4121,16 @@ packages: triple-beam: 1.4.1 dev: true - /lower-case@2.0.2: - resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} + /logform@2.6.0: + resolution: {integrity: sha512-1ulHeNPp6k/LD8H91o7VYFBng5i1BDE7HoKxVbZiGFidS1Rj65qcywLxX+pVfAPoQJEjRdvKcusKwOupHCVOVQ==} + engines: {node: '>= 12.0.0'} dependencies: - tslib: 2.6.1 + '@colors/colors': 1.6.0 + '@types/triple-beam': 1.3.5 + fecha: 4.2.3 + ms: 2.1.3 + safe-stable-stringify: 2.4.3 + triple-beam: 1.4.1 dev: true /lru-cache@10.0.1: @@ -3591,6 +4138,11 @@ packages: engines: {node: 14 || >=16.14} dev: true + /lru-cache@10.2.0: + resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} + engines: {node: 14 || >=16.14} + dev: true + /lru-cache@6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} @@ -3601,7 +4153,7 @@ packages: resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} engines: {node: '>=10'} dependencies: - semver: 7.5.4 + semver: 7.6.0 dev: true /mdurl@1.0.1: @@ -3690,6 +4242,13 @@ packages: brace-expansion: 2.0.1 dev: true + /minimatch@9.0.4: + resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} dev: true @@ -3699,6 +4258,11 @@ packages: engines: {node: '>=16 || 14 >=14.17'} dev: true + /minipass@7.0.4: + resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} + engines: {node: '>=16 || 14 >=14.17'} + dev: true + /mkdirp@0.5.6: resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} hasBin: true @@ -3791,13 +4355,6 @@ packages: engines: {node: '>= 0.6'} dev: true - /no-case@3.0.4: - resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} - dependencies: - lower-case: 2.0.2 - tslib: 2.6.1 - dev: true - /node-domexception@1.0.0: resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} engines: {node: '>=10.5.0'} @@ -3815,6 +4372,18 @@ packages: whatwg-url: 5.0.0 dev: true + /node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + dependencies: + whatwg-url: 5.0.0 + dev: true + /node-fetch@3.3.2: resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -3832,7 +4401,7 @@ packages: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} dependencies: hosted-git-info: 2.8.9 - resolve: 1.22.4 + resolve: 1.22.8 semver: 5.7.2 validate-npm-package-license: 3.0.4 dev: true @@ -3855,6 +4424,10 @@ packages: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} dev: true + /object-inspect@1.13.1: + resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} + dev: true + /object-is@1.1.5: resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==} engines: {node: '>= 0.4'} @@ -3863,6 +4436,14 @@ packages: define-properties: 1.2.0 dev: true + /object-is@1.1.6: + resolution: {integrity: sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + dev: true + /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} engines: {node: '>= 0.4'} @@ -3878,13 +4459,42 @@ packages: object-keys: 1.1.1 dev: true - /object.values@1.1.6: - resolution: {integrity: sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==} + /object.assign@4.1.5: + resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.22.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + has-symbols: 1.0.3 + object-keys: 1.1.1 + dev: true + + /object.fromentries@2.0.8: + resolution: {integrity: sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-object-atoms: 1.0.0 + dev: true + + /object.groupby@1.0.3: + resolution: {integrity: sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + dev: true + + /object.values@1.2.0: + resolution: {integrity: sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-object-atoms: 1.0.0 dev: true /on-finished@2.3.0: @@ -3972,13 +4582,6 @@ packages: engines: {node: '>=6'} dev: true - /param-case@3.0.4: - resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} - dependencies: - dot-case: 3.0.4 - tslib: 2.6.1 - dev: true - /parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -3990,7 +4593,7 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} dependencies: - '@babel/code-frame': 7.23.5 + '@babel/code-frame': 7.24.2 error-ex: 1.3.2 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 @@ -4001,20 +4604,6 @@ packages: engines: {node: '>= 0.8'} dev: true - /pascal-case@3.1.2: - resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} - dependencies: - no-case: 3.0.4 - tslib: 2.6.1 - dev: true - - /path-case@3.0.4: - resolution: {integrity: sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==} - dependencies: - dot-case: 3.0.4 - tslib: 2.6.1 - dev: true - /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -4042,6 +4631,14 @@ packages: minipass: 7.0.3 dev: true + /path-scurry@1.10.2: + resolution: {integrity: sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + lru-cache: 10.2.0 + minipass: 7.0.4 + dev: true + /path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} dev: true @@ -4071,6 +4668,11 @@ packages: engines: {node: '>=4'} dev: true + /possible-typed-array-names@1.0.0: + resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} + engines: {node: '>= 0.4'} + dev: true + /prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -4089,12 +4691,6 @@ packages: hasBin: true dev: true - /prettier@3.1.0: - resolution: {integrity: sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==} - engines: {node: '>=14'} - hasBin: true - dev: true - /prettier@3.1.1: resolution: {integrity: sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==} engines: {node: '>=14'} @@ -4197,7 +4793,7 @@ packages: resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} engines: {node: '>=8'} dependencies: - '@types/normalize-package-data': 2.4.1 + '@types/normalize-package-data': 2.4.4 normalize-package-data: 2.5.0 parse-json: 5.2.0 type-fest: 0.6.0 @@ -4253,6 +4849,16 @@ packages: functions-have-names: 1.2.3 dev: true + /regexp.prototype.flags@1.5.2: + resolution: {integrity: sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-errors: 1.3.0 + set-function-name: 2.0.2 + dev: true + /regjsparser@0.10.0: resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==} hasBin: true @@ -4330,11 +4936,11 @@ packages: engines: {node: '>=4'} dev: true - /resolve@1.22.4: - resolution: {integrity: sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==} + /resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true dependencies: - is-core-module: 2.13.0 + is-core-module: 2.13.1 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 dev: true @@ -4363,12 +4969,12 @@ packages: dependencies: queue-microtask: 1.2.3 - /safe-array-concat@1.0.0: - resolution: {integrity: sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==} + /safe-array-concat@1.1.2: + resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==} engines: {node: '>=0.4'} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.2.1 + call-bind: 1.0.7 + get-intrinsic: 1.2.4 has-symbols: 1.0.3 isarray: 2.0.5 dev: true @@ -4381,11 +4987,12 @@ packages: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} dev: true - /safe-regex-test@1.0.0: - resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} + /safe-regex-test@1.0.3: + resolution: {integrity: sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==} + engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.2.1 + call-bind: 1.0.7 + es-errors: 1.3.0 is-regex: 1.1.4 dev: true @@ -4408,6 +5015,10 @@ packages: resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==} dev: true + /sax@1.3.0: + resolution: {integrity: sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==} + dev: true + /semver@5.7.2: resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==} hasBin: true @@ -4432,6 +5043,7 @@ packages: hasBin: true dependencies: lru-cache: 6.0.0 + dev: false /semver@7.6.0: resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} @@ -4461,14 +5073,6 @@ packages: - supports-color dev: true - /sentence-case@3.0.4: - resolution: {integrity: sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==} - dependencies: - no-case: 3.0.4 - tslib: 2.6.1 - upper-case-first: 2.0.2 - dev: true - /serialize-javascript@6.0.0: resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} dependencies: @@ -4487,6 +5091,28 @@ packages: - supports-color dev: true + /set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.4 + gopd: 1.0.1 + has-property-descriptors: 1.0.2 + dev: true + + /set-function-name@2.0.2: + resolution: {integrity: sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + functions-have-names: 1.2.3 + has-property-descriptors: 1.0.2 + dev: true + /setprototypeof@1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} dev: true @@ -4511,6 +5137,16 @@ packages: object-inspect: 1.12.3 dev: true + /side-channel@1.0.6: + resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.7 + es-errors: 1.3.0 + get-intrinsic: 1.2.4 + object-inspect: 1.13.1 + dev: true + /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: true @@ -4534,22 +5170,10 @@ packages: engines: {node: '>=8'} dev: true - /slash@4.0.0: - resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} - engines: {node: '>=12'} - dev: true - /slash@5.1.0: resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} engines: {node: '>=14.16'} - /snake-case@3.0.4: - resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==} - dependencies: - dot-case: 3.0.4 - tslib: 2.6.1 - dev: true - /source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} dependencies: @@ -4652,29 +5276,31 @@ packages: resolution: {integrity: sha512-1BH+X+1hSthZFW+X+JaUkjkkUPwIlLEMJBLANN3hOob3RhEk5snLWNECDnYbgn/m5c5JV7Ersu1Yubaf+05cIA==} dev: true - /string.prototype.trim@1.2.7: - resolution: {integrity: sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==} + /string.prototype.trim@1.2.9: + resolution: {integrity: sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.22.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + es-object-atoms: 1.0.0 dev: true - /string.prototype.trimend@1.0.6: - resolution: {integrity: sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==} + /string.prototype.trimend@1.0.8: + resolution: {integrity: sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.22.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-object-atoms: 1.0.0 dev: true - /string.prototype.trimstart@1.0.6: - resolution: {integrity: sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==} + /string.prototype.trimstart@1.0.8: + resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} + engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.2.0 - es-abstract: 1.22.1 + call-bind: 1.0.7 + define-properties: 1.2.1 + es-object-atoms: 1.0.0 dev: true /string_decoder@1.1.1: @@ -4833,17 +5459,17 @@ packages: typescript: 5.1.3 dev: true - /ts-api-utils@1.0.1(typescript@5.3.3): + /ts-api-utils@1.0.1(typescript@5.4.4): resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} engines: {node: '>=16.13.0'} peerDependencies: typescript: '>=4.2.0' dependencies: - typescript: 5.3.3 + typescript: 5.4.4 dev: true - /tsconfig-paths@3.14.2: - resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} + /tsconfig-paths@3.15.0: + resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} dependencies: '@types/json5': 0.0.29 json5: 1.0.2 @@ -4857,19 +5483,19 @@ packages: /tslib@2.6.1: resolution: {integrity: sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==} + dev: true /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - dev: true - /tsutils@3.21.0(typescript@5.3.3): + /tsutils@3.21.0(typescript@5.4.4): resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 5.3.3 + typescript: 5.4.4 dev: true /tunnel-agent@0.6.0: @@ -4917,42 +5543,48 @@ packages: mime-types: 2.1.35 dev: true - /typed-array-buffer@1.0.0: - resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} + /typed-array-buffer@1.0.2: + resolution: {integrity: sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.2.1 - is-typed-array: 1.1.12 + call-bind: 1.0.7 + es-errors: 1.3.0 + is-typed-array: 1.1.13 dev: true - /typed-array-byte-length@1.0.0: - resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} + /typed-array-byte-length@1.0.1: + resolution: {integrity: sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 for-each: 0.3.3 - has-proto: 1.0.1 - is-typed-array: 1.1.12 + gopd: 1.0.1 + has-proto: 1.0.3 + is-typed-array: 1.1.13 dev: true - /typed-array-byte-offset@1.0.0: - resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} + /typed-array-byte-offset@1.0.2: + resolution: {integrity: sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==} engines: {node: '>= 0.4'} dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.2 + available-typed-arrays: 1.0.7 + call-bind: 1.0.7 for-each: 0.3.3 - has-proto: 1.0.1 - is-typed-array: 1.1.12 + gopd: 1.0.1 + has-proto: 1.0.3 + is-typed-array: 1.1.13 dev: true - /typed-array-length@1.0.4: - resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} + /typed-array-length@1.0.6: + resolution: {integrity: sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==} + engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 for-each: 0.3.3 - is-typed-array: 1.1.12 + gopd: 1.0.1 + has-proto: 1.0.3 + is-typed-array: 1.1.13 + possible-typed-array-names: 1.0.0 dev: true /typedarray@0.0.6: @@ -4965,8 +5597,14 @@ packages: hasBin: true dev: true - /typescript@5.3.3: - resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} + /typescript@5.1.6: + resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + + /typescript@5.4.4: + resolution: {integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -4974,7 +5612,7 @@ packages: /unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.7 has-bigints: 1.0.2 has-symbols: 1.0.3 which-boxed-primitive: 1.0.2 @@ -4984,12 +5622,16 @@ packages: resolution: {integrity: sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==} dev: true + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + dev: true + /unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} engines: {node: '>=18'} - /universalify@2.0.0: - resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} + /universalify@2.0.1: + resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} dev: true @@ -5009,18 +5651,6 @@ packages: picocolors: 1.0.0 dev: true - /upper-case-first@2.0.2: - resolution: {integrity: sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==} - dependencies: - tslib: 2.6.1 - dev: true - - /upper-case@2.0.2: - resolution: {integrity: sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==} - dependencies: - tslib: 2.6.1 - dev: true - /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: @@ -5089,10 +5719,6 @@ packages: /vscode-languageserver-textdocument@1.0.11: resolution: {integrity: sha512-X+8T3GoiwTVlJbicx/sIAF+yuJAqz8VvwJyoMVhwEMoEKE/fkDmrqUgDMyBECcM2A2frVZIUj5HI/ErRXCfOeA==} - /vscode-languageserver-textdocument@1.0.8: - resolution: {integrity: sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==} - dev: true - /vscode-languageserver-types@3.17.5: resolution: {integrity: sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==} @@ -5137,6 +5763,16 @@ packages: is-weakset: 2.0.2 dev: true + /which-collection@1.0.2: + resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==} + engines: {node: '>= 0.4'} + dependencies: + is-map: 2.0.3 + is-set: 2.0.3 + is-weakmap: 2.0.2 + is-weakset: 2.0.3 + dev: true + /which-typed-array@1.1.11: resolution: {integrity: sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==} engines: {node: '>= 0.4'} @@ -5148,6 +5784,17 @@ packages: has-tostringtag: 1.0.0 dev: true + /which-typed-array@1.1.15: + resolution: {integrity: sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.7 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.2 + dev: true + /which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -5165,6 +5812,15 @@ packages: triple-beam: 1.4.1 dev: true + /winston-transport@4.7.0: + resolution: {integrity: sha512-ajBj65K5I7denzer2IYW6+2bNIVqLGDHqDw3Ow8Ohh+vdW+rv4MZ6eiDvHoKhfJFZ2auyN8byXieDDJ96ViONg==} + engines: {node: '>= 12.0.0'} + dependencies: + logform: 2.6.0 + readable-stream: 3.6.2 + triple-beam: 1.4.1 + dev: true + /winston@3.10.0: resolution: {integrity: sha512-nT6SIDaE9B7ZRO0u3UvdrimG0HkB7dSTAgInQnNR2SOPJ4bvq5q79+pXLftKmP52lJGW15+H5MCK0nM9D3KB/g==} engines: {node: '>= 12.0.0'} @@ -5182,6 +5838,23 @@ packages: winston-transport: 4.5.0 dev: true + /winston@3.13.0: + resolution: {integrity: sha512-rwidmA1w3SE4j0E5MuIufFhyJPBDG7Nu71RkZor1p2+qHvJSZ9GYDA81AyleQcZbh/+V6HjeBdfnTZJm9rSeQQ==} + engines: {node: '>= 12.0.0'} + dependencies: + '@colors/colors': 1.6.0 + '@dabh/diagnostics': 2.0.3 + async: 3.2.5 + is-stream: 2.0.1 + logform: 2.6.0 + one-time: 1.0.0 + readable-stream: 3.6.2 + safe-stable-stringify: 2.4.3 + stack-trace: 0.0.10 + triple-beam: 1.4.1 + winston-transport: 4.7.0 + dev: true + /workerpool@6.2.1: resolution: {integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==} dev: true @@ -5219,7 +5892,7 @@ packages: resolution: {integrity: sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==} engines: {node: '>=4.0.0'} dependencies: - sax: 1.2.4 + sax: 1.3.0 xmlbuilder: 11.0.1 dev: true @@ -5244,6 +5917,11 @@ packages: resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==} engines: {node: '>= 14'} + /yaml@2.4.1: + resolution: {integrity: sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==} + engines: {node: '>= 14'} + hasBin: true + /yargs-parser@20.2.4: resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} engines: {node: '>=10'}