Skip to content

Commit 75f8976

Browse files
committed
Revert "Format"
This reverts commit ab084e2.
1 parent 159de91 commit 75f8976

File tree

15 files changed

+2213
-3045
lines changed

15 files changed

+2213
-3045
lines changed

backends/base.py

+20-21
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def edx_authorize_url(base_url):
2020
Returns:
2121
str: the authorize url
2222
"""
23-
return urljoin(base_url, "/oauth2/authorize/")
23+
return urljoin(base_url, '/oauth2/authorize/')
2424

2525

2626
def edx_access_token_url(base_url):
@@ -33,29 +33,28 @@ def edx_access_token_url(base_url):
3333
Returns:
3434
str: the access token url
3535
"""
36-
return urljoin(base_url, "/oauth2/access_token/")
36+
return urljoin(base_url, '/oauth2/access_token/')
3737

3838

3939
class BaseEdxOAuth2(abc.ABC, BaseOAuth2):
4040
"""
4141
Base edx OAuth2 authentication backend
4242
"""
43-
44-
name = "edxorg"
45-
ID_KEY = "edx_id"
43+
name = 'edxorg'
44+
ID_KEY = 'edx_id'
4645
REQUEST_TOKEN_URL = None
4746
EDXORG_CALLBACK_URL = None
4847

4948
# Settings for Django OAUTH toolkit
50-
DEFAULT_SCOPE = ["read", "write"]
49+
DEFAULT_SCOPE = ['read', 'write']
5150

52-
ACCESS_TOKEN_METHOD = "POST"
51+
ACCESS_TOKEN_METHOD = 'POST'
5352
REDIRECT_STATE = False
5453
EXTRA_DATA = [
55-
("refresh_token", "refresh_token", True),
56-
("expires_in", "expires_in"),
57-
("token_type", "token_type", True),
58-
("scope", "scope"),
54+
('refresh_token', 'refresh_token', True),
55+
('expires_in', 'expires_in'),
56+
('token_type', 'token_type', True),
57+
('scope', 'scope'),
5958
]
6059

6160
@classmethod
@@ -84,9 +83,9 @@ def user_data(self, access_token, *args, **kwargs):
8483
dict: a dictionary containing user information
8584
coming from the remote service.
8685
"""
87-
edx_client = EdxApi({"access_token": access_token}, self.EDXORG_CALLBACK_URL)
86+
edx_client = EdxApi({'access_token': access_token}, self.EDXORG_CALLBACK_URL)
8887
info = edx_client.user_info.get_user_info()
89-
return {"name": info.name, "username": info.username, "email": info.email}
88+
return {'name': info.name, 'username': info.username, 'email': info.email}
9089

9190
def get_user_details(self, response):
9291
"""
@@ -105,16 +104,16 @@ def get_user_details(self, response):
105104
the following keys:
106105
<remote_id>, `username`, `email`, `fullname`, `first_name`, `last_name`
107106
"""
108-
full, _, _ = self.get_user_names(response["name"])
107+
full, _, _ = self.get_user_names(response['name'])
109108

110109
return {
111-
"edx_id": response["username"],
112-
"username": response["username"],
113-
"email": response["email"],
114-
"fullname": full,
110+
'edx_id': response['username'],
111+
'username': response['username'],
112+
'email': response['email'],
113+
'fullname': full,
115114
# the following are not necessary because they are used only inside the User object.
116-
"first_name": "",
117-
"last_name": "",
115+
'first_name': '',
116+
'last_name': '',
118117
}
119118

120119
def get_user_id(self, details, response):
@@ -142,5 +141,5 @@ def refresh_token(self, token, *args, **kwargs):
142141
dict of information about the user
143142
"""
144143
response = super().refresh_token(token, *args, **kwargs)
145-
response["updated_at"] = now_in_utc().timestamp()
144+
response['updated_at'] = now_in_utc().timestamp()
146145
return response

backends/constants.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# courseware backend constants
44
from micromasters.settings import MITXONLINE_BASE_URL, EDXORG_CALLBACK_URL
55

6-
BACKEND_EDX_ORG = "edxorg"
7-
BACKEND_MITX_ONLINE = "mitxonline"
6+
BACKEND_EDX_ORG = 'edxorg'
7+
BACKEND_MITX_ONLINE = 'mitxonline'
88
COURSEWARE_BACKENDS = [
99
BACKEND_MITX_ONLINE,
1010
BACKEND_EDX_ORG,

backends/edxorg.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ class EdxOrgOAuth2(BaseEdxOAuth2):
99
"""
1010
EDX.org OAuth2 authentication backend
1111
"""
12-
13-
name = "edxorg"
12+
name = 'edxorg'
1413
EDX_BASE_URL = settings.EDXORG_BASE_URL
1514
EDXORG_CALLBACK_URL = settings.EDXORG_CALLBACK_URL
1615

0 commit comments

Comments
 (0)