Skip to content

Commit

Permalink
chore: ruff format.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwiker committed Dec 19, 2024
1 parent 5d23f6a commit 34d8e36
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/sumo/wrapper/_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ def get_authorization(self):
return {"Authorization": "Bearer " + token}

def store_shared_access_key_for_case(self, case_uuid, token):
with open(get_token_path(self._resource_id + "+" + case_uuid,
".sharedkey"), "w") as f:
with open(
get_token_path(self._resource_id + "+" + case_uuid, ".sharedkey"),
"w",
) as f:
f.write(token)

pass
Expand Down Expand Up @@ -399,7 +401,7 @@ def get_auth_provider(
access_token=None,
refresh_token=None,
devicecode=False,
case_uuid = None,
case_uuid=None,
):
if refresh_token:
return AuthProviderRefreshToken(
Expand All @@ -409,7 +411,9 @@ def get_auth_provider(
if access_token:
return AuthProviderAccessToken(access_token)
# ELSE
if case_uuid is not None and os.path.exists(get_token_path(resource_id + "+" + case_uuid, ".sharedkey")):
if case_uuid is not None and os.path.exists(
get_token_path(resource_id + "+" + case_uuid, ".sharedkey")
):
return AuthProviderSumoToken(resource_id + "+" + case_uuid)
# ELSE
if os.path.exists(get_token_path(resource_id, ".sharedkey")):
Expand Down
8 changes: 5 additions & 3 deletions src/sumo/wrapper/sumo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
verbosity: str = "CRITICAL",
retry_strategy=RetryStrategy(),
timeout=DEFAULT_TIMEOUT,
case_uuid = None,
case_uuid=None,
):
"""Initialize a new Sumo object
Expand Down Expand Up @@ -86,7 +86,7 @@ def __init__(
refresh_token=refresh_token,
access_token=access_token,
devicecode=devicecode,
case_uuid = case_uuid,
case_uuid=case_uuid,
)

if env == "localhost":
Expand Down Expand Up @@ -413,7 +413,9 @@ def create_shared_access_key_for_case(self, case_uuid):
Side effects:
Creates a new file in ~/.sumo, named {app_id}+{case_uuid}
"""
token = self.get(f"/objects('{case_uuid}')/make-shared-access-key").text
token = self.get(
f"/objects('{case_uuid}')/make-shared-access-key"
).text
self.auth.store_shared_access_key_for_case(case_uuid, token)

@raise_for_status_async
Expand Down

0 comments on commit 34d8e36

Please sign in to comment.