@@ -117,15 +117,12 @@ def get_system_token(self, client_id: str) -> str | None:
117117 del self ._system_tokens [key ]
118118 return None
119119
120- def set_system_token (self , token : str , expires_at : float ,
121- client_id : str ) -> None :
120+ def set_system_token (self , token : str , expires_at : float , client_id : str ) -> None :
122121 """Cache a system token under `client_id`; evict LRU once size exceeds limit."""
123122 key = client_id
124- self ._system_tokens [key ] = _CachedToken (token = token ,
125- expires_at = expires_at )
123+ self ._system_tokens [key ] = _CachedToken (token = token , expires_at = expires_at )
126124 self ._system_tokens .move_to_end (key )
127- while len (self ._system_tokens
128- ) > self ._config .max_system_token_cache_size :
125+ while len (self ._system_tokens ) > self ._config .max_system_token_cache_size :
129126 evicted , _ = self ._system_tokens .popitem (last = False )
130127 logger .debug ("System token cache full — evicted '%s'" , evicted )
131128
@@ -157,8 +154,7 @@ def set_user_token(
157154 ) -> None :
158155 """Cache an exchanged user token; evict LRU once size exceeds limit."""
159156 key = self ._hash_key (user_jwt , client_id )
160- self ._user_tokens [key ] = _CachedToken (token = token ,
161- expires_at = expires_at )
157+ self ._user_tokens [key ] = _CachedToken (token = token , expires_at = expires_at )
162158 self ._user_tokens .move_to_end (key )
163159 while len (self ._user_tokens ) > self ._config .max_user_token_cache_size :
164160 evicted , _ = self ._user_tokens .popitem (last = False )
@@ -185,7 +181,11 @@ def compute_expires_at_from_bearer(self, auth_header: str) -> float:
185181 now_mono = time .monotonic ()
186182 buffer = self ._config .token_expiry_buffer_seconds
187183
188- jwt = auth_header [7 :] if auth_header .lower ().startswith ("bearer " ) else auth_header
184+ jwt = (
185+ auth_header [7 :]
186+ if auth_header .lower ().startswith ("bearer " )
187+ else auth_header
188+ )
189189 exp = _parse_jwt_exp (jwt )
190190 if exp is not None :
191191 remaining = exp - time .time ()
0 commit comments