From 8e541e3dbc407804178d29392189d2029cd20960 Mon Sep 17 00:00:00 2001 From: John Swinbank <swinbank@astron.nl> Date: Tue, 5 Jul 2022 08:35:38 +0200 Subject: [PATCH] Tweak formatting --- esap_client/shopping_client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/esap_client/shopping_client.py b/esap_client/shopping_client.py index 514f276..fc80a2e 100644 --- a/esap_client/shopping_client.py +++ b/esap_client/shopping_client.py @@ -13,6 +13,7 @@ import requests logger = logging.getLogger(__name__) + def is_valid_token(token: str) -> bool: """Check that the given token has not expired""" try: @@ -146,13 +147,13 @@ class ShoppingClient: warn( f"Connector {connector.name} specified but no data found for it " f"in shopping basket. Result will not contain an entry named {connector.name}." - ) + ) return { name: data.to_frame().T if data.ndim < 2 else data.T for name, data in converted_basket.items() } - + warn( "No archive connectors specified - could not convert any basket items to Pandas DataFrame" ) @@ -177,7 +178,9 @@ class ShoppingClient: headers={"Authorization": f"token {jh_api_token}"}, ) - if is_valid_token(token := res.json()["auth_state"]["exchanged_tokens"][self.audience]): + if is_valid_token( + token := res.json()["auth_state"]["exchanged_tokens"][self.audience] + ): return token except KeyError: logger.warning("JupyterHub without Authstate enabled") -- GitLab