Skip to content

Commit

Permalink
chore: Refactor unnecessary else / elif when if block has a `re…
Browse files Browse the repository at this point in the history
…turn` statement (#7332)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
deepsource-autofix[bot] authored Oct 7, 2020
1 parent 3534bd0 commit 1345b92
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
23 changes: 11 additions & 12 deletions app/api/helpers/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,18 @@ def get_credentials(event=None):
'PUBLISHABLE_KEY': settings["stripe_publishable_key"],
}
return None
if represents_int(event):
authorization = StripeAuthorization.query.filter_by(
event_id=event
).first()
else:
if represents_int(event):
authorization = StripeAuthorization.query.filter_by(
event_id=event
).first()
else:
authorization = event.stripe_authorization
if authorization:
return {
'SECRET_KEY': authorization.stripe_secret_key,
'PUBLISHABLE_KEY': authorization.stripe_publishable_key,
}
return None
authorization = event.stripe_authorization
if authorization:
return {
'SECRET_KEY': authorization.stripe_secret_key,
'PUBLISHABLE_KEY': authorization.stripe_publishable_key,
}
return None

@staticmethod
def get_event_organizer_credentials_from_stripe(stripe_auth_code):
Expand Down
3 changes: 1 addition & 2 deletions app/api/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ def is_email_available():
if get_count(db.session.query(User).filter_by(email=email)):
return jsonify(result="False")
return jsonify(result="True")
else:
abort(make_response(jsonify(error="Email field missing"), 422))
abort(make_response(jsonify(error="Email field missing"), 422))


def start_image_resizing_tasks(user, original_image_url):
Expand Down
3 changes: 1 addition & 2 deletions app/views/healthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,4 @@ def health_check_migrations():
return True, result[1]
# the exception will be caught in check_migrations function, so no need for sentry catching exception here
return False, result[1]
else:
return False, 'The health_check_migration test is still running'
return False, 'The health_check_migration test is still running'

0 comments on commit 1345b92

Please sign in to comment.