|
1 | | -# pylint: disable=too-many-lines,too-many-statements |
| 1 | +# pylint: disable=too-many-lines |
2 | 2 | # coding=utf-8 |
3 | 3 | # -------------------------------------------------------------------------- |
4 | 4 | # Copyright (c) Microsoft Corporation. All rights reserved. |
|
9 | 9 | from io import IOBase |
10 | 10 | import json |
11 | 11 | import sys |
12 | | -from typing import ( |
13 | | - Any, |
14 | | - AsyncIterable, |
15 | | - AsyncIterator, |
16 | | - Callable, |
17 | | - Dict, |
18 | | - IO, |
19 | | - List, |
20 | | - Optional, |
21 | | - Type, |
22 | | - TypeVar, |
23 | | - Union, |
24 | | - cast, |
25 | | - overload, |
26 | | -) |
| 12 | +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload |
27 | 13 | import urllib.parse |
28 | 14 |
|
29 | 15 | from azure.core.async_paging import AsyncItemPaged, AsyncList |
|
75 | 61 | if sys.version_info >= (3, 9): |
76 | 62 | from collections.abc import MutableMapping |
77 | 63 | else: |
78 | | - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports |
| 64 | + from typing import MutableMapping # type: ignore |
79 | 65 | T = TypeVar("T") |
80 | 66 | ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] |
81 | 67 | JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object |
@@ -114,7 +100,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: |
114 | 100 |
|
115 | 101 | cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) |
116 | 102 |
|
117 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 103 | + error_map: MutableMapping = { |
118 | 104 | 401: ClientAuthenticationError, |
119 | 105 | 404: ResourceNotFoundError, |
120 | 106 | 409: ResourceExistsError, |
@@ -218,7 +204,7 @@ async def get(self, resource_group_name: str, mongo_cluster_name: str, **kwargs: |
218 | 204 | :rtype: ~azure.mgmt.mongocluster.models.MongoCluster |
219 | 205 | :raises ~azure.core.exceptions.HttpResponseError: |
220 | 206 | """ |
221 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 207 | + error_map: MutableMapping = { |
222 | 208 | 401: ClientAuthenticationError, |
223 | 209 | 404: ResourceNotFoundError, |
224 | 210 | 409: ResourceExistsError, |
@@ -281,7 +267,7 @@ async def _create_or_update_initial( |
281 | 267 | resource: Union[_models.MongoCluster, JSON, IO[bytes]], |
282 | 268 | **kwargs: Any |
283 | 269 | ) -> AsyncIterator[bytes]: |
284 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 270 | + error_map: MutableMapping = { |
285 | 271 | 401: ClientAuthenticationError, |
286 | 272 | 404: ResourceNotFoundError, |
287 | 273 | 409: ResourceExistsError, |
@@ -520,7 +506,7 @@ async def _update_initial( |
520 | 506 | properties: Union[_models.MongoClusterUpdate, JSON, IO[bytes]], |
521 | 507 | **kwargs: Any |
522 | 508 | ) -> AsyncIterator[bytes]: |
523 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 509 | + error_map: MutableMapping = { |
524 | 510 | 401: ClientAuthenticationError, |
525 | 511 | 404: ResourceNotFoundError, |
526 | 512 | 409: ResourceExistsError, |
@@ -756,7 +742,7 @@ def get_long_running_output(pipeline_response): |
756 | 742 | async def _delete_initial( |
757 | 743 | self, resource_group_name: str, mongo_cluster_name: str, **kwargs: Any |
758 | 744 | ) -> AsyncIterator[bytes]: |
759 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 745 | + error_map: MutableMapping = { |
760 | 746 | 401: ClientAuthenticationError, |
761 | 747 | 404: ResourceNotFoundError, |
762 | 748 | 409: ResourceExistsError, |
@@ -891,7 +877,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy |
891 | 877 |
|
892 | 878 | cls: ClsType[List[_models.MongoCluster]] = kwargs.pop("cls", None) |
893 | 879 |
|
894 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 880 | + error_map: MutableMapping = { |
895 | 881 | 401: ClientAuthenticationError, |
896 | 882 | 404: ResourceNotFoundError, |
897 | 883 | 409: ResourceExistsError, |
@@ -979,7 +965,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.MongoCluster"]: |
979 | 965 |
|
980 | 966 | cls: ClsType[List[_models.MongoCluster]] = kwargs.pop("cls", None) |
981 | 967 |
|
982 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 968 | + error_map: MutableMapping = { |
983 | 969 | 401: ClientAuthenticationError, |
984 | 970 | 404: ResourceNotFoundError, |
985 | 971 | 409: ResourceExistsError, |
@@ -1070,7 +1056,7 @@ async def list_connection_strings( |
1070 | 1056 | :rtype: ~azure.mgmt.mongocluster.models.ListConnectionStringsResult |
1071 | 1057 | :raises ~azure.core.exceptions.HttpResponseError: |
1072 | 1058 | """ |
1073 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 1059 | + error_map: MutableMapping = { |
1074 | 1060 | 401: ClientAuthenticationError, |
1075 | 1061 | 404: ResourceNotFoundError, |
1076 | 1062 | 409: ResourceExistsError, |
@@ -1204,7 +1190,7 @@ async def check_name_availability( |
1204 | 1190 | :rtype: ~azure.mgmt.mongocluster.models.CheckNameAvailabilityResponse |
1205 | 1191 | :raises ~azure.core.exceptions.HttpResponseError: |
1206 | 1192 | """ |
1207 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 1193 | + error_map: MutableMapping = { |
1208 | 1194 | 401: ClientAuthenticationError, |
1209 | 1195 | 404: ResourceNotFoundError, |
1210 | 1196 | 409: ResourceExistsError, |
@@ -1287,7 +1273,7 @@ async def _promote_initial( |
1287 | 1273 | body: Union[_models.PromoteReplicaRequest, JSON, IO[bytes]], |
1288 | 1274 | **kwargs: Any |
1289 | 1275 | ) -> AsyncIterator[bytes]: |
1290 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 1276 | + error_map: MutableMapping = { |
1291 | 1277 | 401: ClientAuthenticationError, |
1292 | 1278 | 404: ResourceNotFoundError, |
1293 | 1279 | 409: ResourceExistsError, |
@@ -1552,7 +1538,7 @@ async def get( |
1552 | 1538 | :rtype: ~azure.mgmt.mongocluster.models.FirewallRule |
1553 | 1539 | :raises ~azure.core.exceptions.HttpResponseError: |
1554 | 1540 | """ |
1555 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 1541 | + error_map: MutableMapping = { |
1556 | 1542 | 401: ClientAuthenticationError, |
1557 | 1543 | 404: ResourceNotFoundError, |
1558 | 1544 | 409: ResourceExistsError, |
@@ -1617,7 +1603,7 @@ async def _create_or_update_initial( |
1617 | 1603 | resource: Union[_models.FirewallRule, JSON, IO[bytes]], |
1618 | 1604 | **kwargs: Any |
1619 | 1605 | ) -> AsyncIterator[bytes]: |
1620 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 1606 | + error_map: MutableMapping = { |
1621 | 1607 | 401: ClientAuthenticationError, |
1622 | 1608 | 404: ResourceNotFoundError, |
1623 | 1609 | 409: ResourceExistsError, |
@@ -1863,7 +1849,7 @@ def get_long_running_output(pipeline_response): |
1863 | 1849 | async def _delete_initial( |
1864 | 1850 | self, resource_group_name: str, mongo_cluster_name: str, firewall_rule_name: str, **kwargs: Any |
1865 | 1851 | ) -> AsyncIterator[bytes]: |
1866 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 1852 | + error_map: MutableMapping = { |
1867 | 1853 | 401: ClientAuthenticationError, |
1868 | 1854 | 404: ResourceNotFoundError, |
1869 | 1855 | 409: ResourceExistsError, |
@@ -2006,7 +1992,7 @@ def list_by_mongo_cluster( |
2006 | 1992 |
|
2007 | 1993 | cls: ClsType[List[_models.FirewallRule]] = kwargs.pop("cls", None) |
2008 | 1994 |
|
2009 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 1995 | + error_map: MutableMapping = { |
2010 | 1996 | 401: ClientAuthenticationError, |
2011 | 1997 | 404: ResourceNotFoundError, |
2012 | 1998 | 409: ResourceExistsError, |
@@ -2121,7 +2107,7 @@ def list_by_mongo_cluster( |
2121 | 2107 |
|
2122 | 2108 | cls: ClsType[List[_models.PrivateEndpointConnectionResource]] = kwargs.pop("cls", None) |
2123 | 2109 |
|
2124 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 2110 | + error_map: MutableMapping = { |
2125 | 2111 | 401: ClientAuthenticationError, |
2126 | 2112 | 404: ResourceNotFoundError, |
2127 | 2113 | 409: ResourceExistsError, |
@@ -2216,7 +2202,7 @@ async def get( |
2216 | 2202 | :rtype: ~azure.mgmt.mongocluster.models.PrivateEndpointConnectionResource |
2217 | 2203 | :raises ~azure.core.exceptions.HttpResponseError: |
2218 | 2204 | """ |
2219 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 2205 | + error_map: MutableMapping = { |
2220 | 2206 | 401: ClientAuthenticationError, |
2221 | 2207 | 404: ResourceNotFoundError, |
2222 | 2208 | 409: ResourceExistsError, |
@@ -2281,7 +2267,7 @@ async def _create_initial( |
2281 | 2267 | resource: Union[_models.PrivateEndpointConnectionResource, JSON, IO[bytes]], |
2282 | 2268 | **kwargs: Any |
2283 | 2269 | ) -> AsyncIterator[bytes]: |
2284 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 2270 | + error_map: MutableMapping = { |
2285 | 2271 | 401: ClientAuthenticationError, |
2286 | 2272 | 404: ResourceNotFoundError, |
2287 | 2273 | 409: ResourceExistsError, |
@@ -2540,7 +2526,7 @@ def get_long_running_output(pipeline_response): |
2540 | 2526 | async def _delete_initial( |
2541 | 2527 | self, resource_group_name: str, mongo_cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any |
2542 | 2528 | ) -> AsyncIterator[bytes]: |
2543 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 2529 | + error_map: MutableMapping = { |
2544 | 2530 | 401: ClientAuthenticationError, |
2545 | 2531 | 404: ResourceNotFoundError, |
2546 | 2532 | 409: ResourceExistsError, |
@@ -2703,7 +2689,7 @@ def list_by_mongo_cluster( |
2703 | 2689 |
|
2704 | 2690 | cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) |
2705 | 2691 |
|
2706 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 2692 | + error_map: MutableMapping = { |
2707 | 2693 | 401: ClientAuthenticationError, |
2708 | 2694 | 404: ResourceNotFoundError, |
2709 | 2695 | 409: ResourceExistsError, |
@@ -2827,7 +2813,7 @@ def list_by_parent( |
2827 | 2813 |
|
2828 | 2814 | cls: ClsType[List[_models.Replica]] = kwargs.pop("cls", None) |
2829 | 2815 |
|
2830 | | - error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object |
| 2816 | + error_map: MutableMapping = { |
2831 | 2817 | 401: ClientAuthenticationError, |
2832 | 2818 | 404: ResourceNotFoundError, |
2833 | 2819 | 409: ResourceExistsError, |
|
0 commit comments