File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -208,24 +208,20 @@ def _adls(properties: Properties) -> AbstractFileSystem:
208208 properties [ADLS_SAS_TOKEN ] = sas_token
209209
210210 class StaticTokenCredential (AsyncTokenCredential ):
211+ _DEFAULT_EXPIRY_SECONDS = 3600
212+
211213 def __init__ (self , token_string : str ) -> None :
212214 self ._token = token_string
213- # If no expiry provided, set 1 hour from now
214- self ._expires_on = int (time .time ()) + 3600
215+ # Set expiration 1 hour from now
216+ self ._expires_on = int (time .time ()) + self . _DEFAULT_EXPIRY_SECONDS
215217
216218 async def get_token (self , * scopes : str , ** kwargs : Any ) -> AccessToken :
217219 return AccessToken (self ._token , self ._expires_on )
218220
219- if ADLS_TOKEN in properties :
220- token = properties .get (ADLS_TOKEN )
221- if token is not None :
222- credential = StaticTokenCredential (token )
223- else :
224- credential = None
225- elif ADLS_CREDENTIAL in properties :
226- credential = properties .get (ADLS_CREDENTIAL )
221+ if token := properties .get (ADLS_TOKEN ):
222+ credential = StaticTokenCredential (token )
227223 else :
228- credential = None
224+ credential = properties . get ( ADLS_CREDENTIAL ) # type: ignore
229225
230226 return AzureBlobFileSystem (
231227 connection_string = properties .get (ADLS_CONNECTION_STRING ),
You can’t perform that action at this time.
0 commit comments