Skip to content

Commit

Permalink
fix pyright and regen
Browse files Browse the repository at this point in the history
  • Loading branch information
tadelesh committed Apr 7, 2024
1 parent 67bf2aa commit 57a3c1a
Show file tree
Hide file tree
Showing 722 changed files with 6,998 additions and 6,988 deletions.
10 changes: 10 additions & 0 deletions packages/autorest.python/autorest/codegen/models/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,16 @@ def imports( # pylint: disable=too-many-branches, disable=too-many-statements
"Type",
ImportType.STDLIB,
)
file_import.add_submodule_import(
"typing",
"Callable",
ImportType.STDLIB,
)
file_import.add_submodule_import(
"typing",
"Union",
ImportType.STDLIB,
)
file_import.add_mutable_mapping_import()
if self.non_default_error_status_codes:
file_import.add_submodule_import(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: MutableMapping[int, Type[HttpResponseError]] = {"]
retval = ["error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {"]
if builder.non_default_errors:
if not 401 in builder.non_default_error_status_codes:
retval.append(" 401: ClientAuthenticationError,")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, Type, TypeVar
from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -60,7 +60,7 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -103,7 +103,7 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -146,7 +146,7 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, Type, TypeVar
from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -80,7 +80,7 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -123,7 +123,7 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -166,7 +166,7 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, Type, TypeVar
from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -60,7 +60,7 @@ async def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -103,7 +103,7 @@ async def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -146,7 +146,7 @@ async def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, Type, TypeVar
from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -80,7 +80,7 @@ def head200(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -123,7 +123,7 @@ def head204(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -166,7 +166,7 @@ def head404(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -295,7 +295,7 @@ def basic_paging(self, **kwargs: Any) -> Iterable[JSON]:

cls: ClsType[JSON] = kwargs.pop("cls", None)

error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -272,7 +272,7 @@ def basic_paging(self, **kwargs: Any) -> AsyncIterable[JSON]:

cls: ClsType[JSON] = kwargs.pop("cls", None)

error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, Type, TypeVar
from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -59,7 +59,7 @@ async def head200(self, **kwargs: Any) -> bool:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -102,7 +102,7 @@ async def head204(self, **kwargs: Any) -> bool:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -145,7 +145,7 @@ async def head404(self, **kwargs: Any) -> bool:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, Type, TypeVar
from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -83,7 +83,7 @@ def head200(self, **kwargs: Any) -> bool:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -126,7 +126,7 @@ def head204(self, **kwargs: Any) -> bool:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -169,7 +169,7 @@ def head404(self, **kwargs: Any) -> bool:
:rtype: bool
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def test_one( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -113,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: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -265,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: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -337,7 +337,7 @@ async def begin_test_lro_and_paging(

cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None)

error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -454,7 +454,7 @@ async def test_different_calls( # pylint: disable=inconsistent-return-statement
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, Type, TypeVar
from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -65,7 +65,7 @@ async def test_two(self, **kwargs: Any) -> None: # pylint: disable=inconsistent
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_one( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -190,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: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -339,7 +339,7 @@ def _test_lro_and_paging_initial(
test_lro_and_paging_options: Optional[_models.TestLroAndPagingOptions] = None,
**kwargs: Any
) -> _models.PagingResult:
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -411,7 +411,7 @@ def begin_test_lro_and_paging(

cls: ClsType[_models.PagingResult] = kwargs.pop("cls", None)

error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -528,7 +528,7 @@ def test_different_calls( # pylint: disable=inconsistent-return-statements
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Union[Type[HttpResponseError], Callable]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down
Loading

0 comments on commit 57a3c1a

Please sign in to comment.