File tree Expand file tree Collapse file tree 6 files changed +16
-18
lines changed
sdk/identity/azure-identity/azure/identity/aio/_credentials Expand file tree Collapse file tree 6 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,7 @@ def __init__(self, **kwargs: "Any") -> None:
2626 else :
2727 self ._available = False
2828
29- async def get_token ( # pylint:disable=invalid-overridden-method
30- self , * scopes : str , ** kwargs : "Any"
31- ) -> "AccessToken" :
29+ async def get_token (self , * scopes : str , ** kwargs : "Any" ) -> "AccessToken" :
3230 if not self ._available :
3331 raise CredentialUnavailableError (
3432 message = "App Service managed identity configuration not found in environment"
@@ -37,7 +35,7 @@ async def get_token( # pylint:disable=invalid-overridden-method
3735 return await super ().get_token (* scopes , ** kwargs )
3836
3937 async def close (self ) -> None :
40- await self ._client .close () # pylint:disable=no-member
38+ await self ._client .close ()
4139
4240 async def _acquire_token_silently (self , * scopes : str ) -> "Optional[AccessToken]" :
4341 return self ._client .get_cached_token (* scopes )
Original file line number Diff line number Diff line change @@ -52,9 +52,7 @@ def __init__(self, **kwargs: "Any") -> None:
5252 ** kwargs
5353 )
5454
55- async def get_token ( # pylint:disable=invalid-overridden-method
56- self , * scopes : str , ** kwargs : "Any"
57- ) -> "AccessToken" :
55+ async def get_token (self , * scopes : str , ** kwargs : "Any" ) -> "AccessToken" :
5856 if not self ._available :
5957 raise CredentialUnavailableError (
6058 message = "Service Fabric managed identity configuration not found in environment"
@@ -63,7 +61,7 @@ async def get_token( # pylint:disable=invalid-overridden-method
6361 return await super ().get_token (* scopes , ** kwargs )
6462
6563 async def close (self ) -> None :
66- await self ._client .close () # pylint:disable=no-member
64+ await self ._client .close ()
6765
6866 async def _acquire_token_silently (self , * scopes : str ) -> "Optional[AccessToken]" :
6967 return self ._client .get_cached_token (* scopes )
Original file line number Diff line number Diff line change 55import asyncio
66import sys
77import os
8+ from typing import TYPE_CHECKING
89
910from azure .core .exceptions import ClientAuthenticationError
1011from .._internal import AsyncContextManager
2122)
2223from ..._internal import _scopes_to_resource
2324
25+ if TYPE_CHECKING :
26+ from typing import Any
27+ from azure .core .credentials import AccessToken
28+
2429
2530class AzureCliCredential (AsyncContextManager ):
2631 """Authenticates by requesting a token from the Azure CLI.
@@ -29,7 +34,7 @@ class AzureCliCredential(AsyncContextManager):
2934 """
3035
3136 @log_get_token_async
32- async def get_token (self , * scopes , ** kwargs ) :
37+ async def get_token (self , * scopes : str , ** kwargs : "Any" ) -> "AccessToken" :
3338 """Request an access token for `scopes`.
3439
3540 This method is called automatically by Azure SDK clients. Applications calling this method directly must
@@ -60,7 +65,7 @@ async def close(self):
6065 """Calling this method is unnecessary"""
6166
6267
63- async def _run_command (command ) :
68+ async def _run_command (command : str ) -> str :
6469 if sys .platform .startswith ("win" ):
6570 args = ("cmd" , "/c " + command )
6671 else :
Original file line number Diff line number Diff line change 1717
1818if TYPE_CHECKING :
1919 from typing import Any , List
20+ from azure .core .credentials import AccessToken
2021 from azure .core .credentials_async import AsyncTokenCredential
2122
2223_LOGGER = logging .getLogger (__name__ )
@@ -99,7 +100,6 @@ def __init__(self, **kwargs: "Any") -> None:
99100 )
100101 credentials .append (shared_cache )
101102 except Exception as ex : # pylint:disable=broad-except
102- # transitive dependency pywin32 doesn't support 3.8 (https://github.com/mhammond/pywin32/issues/1431)
103103 _LOGGER .info ("Shared token cache is unavailable: '%s'" , ex )
104104 if not exclude_visual_studio_code_credential :
105105 credentials .append (VisualStudioCodeCredential (tenant_id = vscode_tenant_id ))
@@ -108,7 +108,7 @@ def __init__(self, **kwargs: "Any") -> None:
108108
109109 super ().__init__ (* credentials )
110110
111- async def get_token (self , * scopes : str , ** kwargs : "Any" ):
111+ async def get_token (self , * scopes : str , ** kwargs : "Any" ) -> "AccessToken" :
112112 """Asynchronously request an access token for `scopes`.
113113
114114 This method is called automatically by Azure SDK clients.
Original file line number Diff line number Diff line change @@ -26,9 +26,7 @@ def __init__(self, **kwargs: "Any") -> None:
2626 else :
2727 self ._available = False
2828
29- async def get_token ( # pylint:disable=invalid-overridden-method
30- self , * scopes : str , ** kwargs : "Any"
31- ) -> "AccessToken" :
29+ async def get_token (self , * scopes : str , ** kwargs : "Any" ) -> "AccessToken" :
3230 if not self ._available :
3331 raise CredentialUnavailableError (
3432 message = "Service Fabric managed identity configuration not found in environment"
@@ -37,7 +35,7 @@ async def get_token( # pylint:disable=invalid-overridden-method
3735 return await super ().get_token (* scopes , ** kwargs )
3836
3937 async def close (self ) -> None :
40- await self ._client .close () # pylint:disable=no-member
38+ await self ._client .close ()
4139
4240 async def _acquire_token_silently (self , * scopes : str ) -> "Optional[AccessToken]" :
4341 return self ._client .get_cached_token (* scopes )
Original file line number Diff line number Diff line change @@ -48,8 +48,7 @@ async def close(self):
4848 if self ._client :
4949 await self ._client .__aexit__ ()
5050
51- async def get_token (self , * scopes , ** kwargs ):
52- # type: (*str, **Any) -> AccessToken
51+ async def get_token (self , * scopes : str , ** kwargs : "Any" ) -> "AccessToken" :
5352 """Request an access token for `scopes` as the user currently signed in to Visual Studio Code.
5453
5554 This method is called automatically by Azure SDK clients.
You can’t perform that action at this time.
0 commit comments