Skip to content

Commit

Permalink
Use f-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Nov 7, 2023
1 parent c7ab1e9 commit 949ba18
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions features/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_array_from_json(context: Context, selector, subselector=None):

# try to retrieve content of given array
assert selector in json, \
"attribute '{}' is not found in JSON response".format(selector)
f"attribute '{selector}' is not found in JSON response"

# return items from array is subselector is not specified
if subselector is None:
Expand All @@ -45,19 +45,17 @@ def construct_rh_token(org: int, account: str, user: str) -> bytes:
assert user, "User ID should not be empty"

# text token
token = """
token = f"""
{{
"identity": {{
"org_id": "{}",
"account_number":"{}",
"org_id": "{org}",
"account_number":"{account}",
"user": {{
"user_id":"{}"
"user_id":"{user}"
}}
}}
}}
""".format(
org, account, user
)
"""

# convert to base64 encoding
return base64.b64encode(token.encode("ascii"))
Expand Down

0 comments on commit 949ba18

Please sign in to comment.