Skip to content

Commit 13bd6d3

Browse files
chore: Simplify the if statement (#7327)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
1 parent 1e050e8 commit 13bd6d3

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

app/models/setting.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,7 @@ def __repr__(self):
212212

213213
@hybrid_property
214214
def is_alipay_activated(self):
215-
if self.alipay_publishable_key and self.alipay_secret_key:
216-
return True
217-
else:
218-
return False
215+
return bool(self.alipay_publishable_key and self.alipay_secret_key)
219216

220217
@hybrid_property
221218
def is_omise_activated(self):

app/models/user.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,7 @@ def is_speaker_at_session(self, session_id):
319319
.filter(Session.id == session_id)
320320
.one()
321321
)
322-
if session:
323-
return True
324-
else:
325-
return False
322+
return bool(session)
326323
except MultipleResultsFound:
327324
return False
328325
except NoResultFound:
@@ -335,10 +332,7 @@ def is_speaker_at_event(self, event_id):
335332
.filter(Session.event_id == event_id)
336333
.first()
337334
)
338-
if session:
339-
return True
340-
else:
341-
return False
335+
return bool(session)
342336
except MultipleResultsFound:
343337
return False
344338
except NoResultFound:

0 commit comments

Comments
 (0)