Skip to content

Commit 9f8064d

Browse files
authored
Merge pull request #469 from Viicos/use-fstrings
2 parents 4360c60 + f7a882e commit 9f8064d

46 files changed

Lines changed: 107 additions & 119 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

auth0/asyncify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(
6666
for method in methods:
6767
setattr(
6868
self,
69-
"{}_async".format(method),
69+
f"{method}_async",
7070
_gen_async(self._async_client, method),
7171
)
7272

auth0/authentication/async_token_verifier.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ async def get_key(self, key_id):
111111
keys = await self._fetch_jwks(force=True)
112112
if keys and key_id in keys:
113113
return keys[key_id]
114-
raise TokenValidationError(
115-
'RSA Public Key with ID "{}" was not found.'.format(key_id)
116-
)
114+
raise TokenValidationError(f'RSA Public Key with ID "{key_id}" was not found.')
117115

118116

119117
class AsyncTokenVerifier(TokenVerifier):

auth0/authentication/client_authentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def create_client_assertion_jwt(
2424
{
2525
"iss": client_id,
2626
"sub": client_id,
27-
"aud": "https://{}/".format(domain),
27+
"aud": f"https://{domain}/",
2828
"iat": now,
2929
"exp": now + datetime.timedelta(seconds=180),
3030
"jti": str(uuid.uuid4()),

auth0/authentication/database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def signup(
7272
body.update({"picture": picture})
7373

7474
return self.post(
75-
"{}://{}/dbconnections/signup".format(self.protocol, self.domain), data=body
75+
f"{self.protocol}://{self.domain}/dbconnections/signup", data=body
7676
)
7777

7878
def change_password(self, email, connection, password=None):
@@ -89,6 +89,6 @@ def change_password(self, email, connection, password=None):
8989
}
9090

9191
return self.post(
92-
"{}://{}/dbconnections/change_password".format(self.protocol, self.domain),
92+
f"{self.protocol}://{self.domain}/dbconnections/change_password",
9393
data=body,
9494
)

auth0/authentication/delegated.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,4 @@ def get_token(
3838
else:
3939
raise ValueError("Either id_token or refresh_token must have a value")
4040

41-
return self.post(
42-
"{}://{}/delegation".format(self.protocol, self.domain), data=data
43-
)
41+
return self.post(f"{self.protocol}://{self.domain}/delegation", data=data)

auth0/authentication/get_token.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def authorization_code(
3636
"""
3737

3838
return self.authenticated_post(
39-
"{}://{}/oauth/token".format(self.protocol, self.domain),
39+
f"{self.protocol}://{self.domain}/oauth/token",
4040
data={
4141
"client_id": self.client_id,
4242
"code": code,
@@ -74,7 +74,7 @@ def authorization_code_pkce(
7474
"""
7575

7676
return self.post(
77-
"{}://{}/oauth/token".format(self.protocol, self.domain),
77+
f"{self.protocol}://{self.domain}/oauth/token",
7878
data={
7979
"client_id": self.client_id,
8080
"code_verifier": code_verifier,
@@ -106,7 +106,7 @@ def client_credentials(
106106
"""
107107

108108
return self.authenticated_post(
109-
"{}://{}/oauth/token".format(self.protocol, self.domain),
109+
f"{self.protocol}://{self.domain}/oauth/token",
110110
data={
111111
"client_id": self.client_id,
112112
"audience": audience,
@@ -154,7 +154,7 @@ def login(
154154
"""
155155

156156
return self.authenticated_post(
157-
"{}://{}/oauth/token".format(self.protocol, self.domain),
157+
f"{self.protocol}://{self.domain}/oauth/token",
158158
data={
159159
"client_id": self.client_id,
160160
"username": username,
@@ -190,7 +190,7 @@ def refresh_token(
190190
"""
191191

192192
return self.authenticated_post(
193-
"{}://{}/oauth/token".format(self.protocol, self.domain),
193+
f"{self.protocol}://{self.domain}/oauth/token",
194194
data={
195195
"client_id": self.client_id,
196196
"refresh_token": refresh_token,
@@ -223,7 +223,7 @@ def passwordless_login(self, username, otp, realm, scope, audience):
223223
"""
224224

225225
return self.authenticated_post(
226-
"{}://{}/oauth/token".format(self.protocol, self.domain),
226+
f"{self.protocol}://{self.domain}/oauth/token",
227227
data={
228228
"client_id": self.client_id,
229229
"username": username,

auth0/authentication/passwordless.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def email(self, email, send="link", auth_params=None):
4545
data.update({"authParams": auth_params})
4646

4747
return self.authenticated_post(
48-
"{}://{}/passwordless/start".format(self.protocol, self.domain), data=data
48+
f"{self.protocol}://{self.domain}/passwordless/start", data=data
4949
)
5050

5151
def sms(self, phone_number):
@@ -68,5 +68,5 @@ def sms(self, phone_number):
6868
}
6969

7070
return self.authenticated_post(
71-
"{}://{}/passwordless/start".format(self.protocol, self.domain), data=data
71+
f"{self.protocol}://{self.domain}/passwordless/start", data=data
7272
)

auth0/authentication/revoke_token.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ def revoke_refresh_token(self, token):
2626
}
2727

2828
return self.authenticated_post(
29-
"{}://{}/oauth/revoke".format(self.protocol, self.domain), data=body
29+
f"{self.protocol}://{self.domain}/oauth/revoke", data=body
3030
)

auth0/authentication/social.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def login(self, access_token, connection, scope="openid"):
2727
"""
2828

2929
return self.post(
30-
"{}://{}/oauth/access_token".format(self.protocol, self.domain),
30+
f"{self.protocol}://{self.domain}/oauth/access_token",
3131
data={
3232
"client_id": self.client_id,
3333
"access_token": access_token,

auth0/authentication/token_verifier.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@ def get_key(self, key_id):
236236
keys = self._fetch_jwks(force=True)
237237
if keys and key_id in keys:
238238
return keys[key_id]
239-
raise TokenValidationError(
240-
'RSA Public Key with ID "{}" was not found.'.format(key_id)
241-
)
239+
raise TokenValidationError(f'RSA Public Key with ID "{key_id}" was not found.')
242240

243241

244242
class TokenVerifier:

0 commit comments

Comments
 (0)