refactor: refactor unnecessary else / elif when if block has a raise statement

`raise` causes control flow to be disrupted, as it will exit the block.
It is recommended to check other conditions using another `if` statement, and get rid of `else` statements as they are unnecessary.
This commit is contained in:
deepsource-autofix[bot] 2023-09-08 23:47:21 +00:00 committed by GitHub
parent 7b7f30067b
commit 8a0477d086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,7 +63,7 @@ def get_env_or_error(env: str) -> str:
if from_file is None and from_env is None:
raise KeyError(f"Environment variable {env} not found")
elif from_file is None:
if from_file is None:
return from_env
else:
return from_file