@@ -88,7 +88,9 @@ async def get_token(
8888 )
8989
9090 # only ProactorEventLoop supports subprocesses on Windows (and it isn't the default loop on Python < 3.8)
91- if sys .platform .startswith ("win" ) and not isinstance (asyncio .get_event_loop (), asyncio .ProactorEventLoop ):
91+ if sys .platform .startswith ("win" ) and not isinstance (
92+ asyncio .get_event_loop (), asyncio .ProactorEventLoop
93+ ):
9294 return _SyncCredential ().get_token (* scopes , tenant_id = tenant_id , ** kwargs )
9395
9496 options : TokenRequestOptions = {}
@@ -99,7 +101,9 @@ async def get_token(
99101 return AccessToken (token_info .token , token_info .expires_on )
100102
101103 @log_get_token_async
102- async def get_token_info (self , * scopes : str , options : Optional [TokenRequestOptions ] = None ) -> AccessTokenInfo :
104+ async def get_token_info (
105+ self , * scopes : str , options : Optional [TokenRequestOptions ] = None
106+ ) -> AccessTokenInfo :
103107 """Request an access token for `scopes`.
104108
105109 This is an alternative to `get_token` to enable certain scenarios that require additional properties
@@ -127,7 +131,9 @@ async def get_token_info(self, *scopes: str, options: Optional[TokenRequestOptio
127131 message = f"Fail to get token, please run Connect-AzAccount --ClaimsChallenge { claims_value } "
128132 )
129133
130- if sys .platform .startswith ("win" ) and not isinstance (asyncio .get_event_loop (), asyncio .ProactorEventLoop ):
134+ if sys .platform .startswith ("win" ) and not isinstance (
135+ asyncio .get_event_loop (), asyncio .ProactorEventLoop
136+ ):
131137 return _SyncCredential ().get_token_info (* scopes , options = options )
132138 return await self ._get_token_base (* scopes , options = options )
133139
@@ -167,7 +173,9 @@ async def run_command_line(command_line: List[str], timeout: int) -> str:
167173 try :
168174 proc = await start_process (command_line )
169175 stdout , stderr = await asyncio .wait_for (proc .communicate (), 10 )
170- if sys .platform .startswith ("win" ) and (b"' is not recognized" in stderr or proc .returncode == 9009 ):
176+ if sys .platform .startswith ("win" ) and (
177+ b"' is not recognized" in stderr or proc .returncode == 9009
178+ ):
171179 # pwsh.exe isn't on the path; try powershell.exe
172180 command_line [- 1 ] = command_line [- 1 ].replace ("pwsh" , "powershell" , 1 )
173181 proc = await start_process (command_line )
@@ -185,7 +193,9 @@ async def run_command_line(command_line: List[str], timeout: int) -> str:
185193 error = CredentialUnavailableError (
186194 message = 'Failed to execute "{}".\n '
187195 "To mitigate this issue, please refer to the troubleshooting guidelines here at "
188- "https://aka.ms/azsdk/python/identity/powershellcredential/troubleshoot." .format (command_line [0 ])
196+ "https://aka.ms/azsdk/python/identity/powershellcredential/troubleshoot." .format (
197+ command_line [0 ]
198+ )
189199 )
190200 raise error from ex
191201
0 commit comments