Skip to content

Commit c73ba4c

Browse files
committed
chore: move return statements outside try block
The try/except block should be used only for code expected to fail.
1 parent c09a712 commit c73ba4c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ ignore = [
151151
"PLW0603", # TODO: Using the global statement to update `BACKENDSCACHE` is discouraged
152152
"TRY301", # TODO: Abstract `raise` to an inner function
153153
"BLE001", # TODO: Do not catch blind exception: `Exception`
154-
"S110", # TODO: `try`-`except`-`pass` detected, consider logging the exception
155-
"TRY300" # TODO: Consider moving this statement to an `else` block
154+
"S110" # TODO: `try`-`except`-`pass` detected, consider logging the exception
156155
]
157156
select = ["ALL"]
158157

social_core/backends/line.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def user_data(self, access_token, *args, **kwargs):
9898
self.USER_INFO_URL, headers={"Authorization": f"Bearer {access_token}"}
9999
)
100100
self.process_error(response)
101-
return response
102101
except requests.HTTPError as err:
103102
self.process_error(err.response.json())
103+
return None
104+
return response

social_core/backends/uffd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def user_data(self, access_token, *args, **kwargs):
4040
url = self.userinfo_url() + "?" + urlencode({"access_token": access_token})
4141
try:
4242
user_data: dict[str, Any] = self.get_json(url)
43-
return user_data
4443
except ValueError:
4544
return None
45+
return user_data
4646

4747
def authorization_url(self):
4848
return self.setting("BASE_URL") + "/oauth2/authorize"

0 commit comments

Comments
 (0)