Refactor unnecessary else / elif when if block has a raise statement

This commit is contained in:
deepsource-autofix[bot] 2020-11-08 22:01:07 +00:00 committed by GitHub
parent 44a07f26ed
commit 7ca09aac1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -109,9 +109,9 @@ def check_result(method_name: str, content_type: str, status_code: int, body: st
return result_json.get('result')
if parameters.retry_after:
raise exceptions.RetryAfter(parameters.retry_after)
elif parameters.migrate_to_chat_id:
if parameters.migrate_to_chat_id:
raise exceptions.MigrateToChat(parameters.migrate_to_chat_id)
elif status_code == HTTPStatus.BAD_REQUEST:
if status_code == HTTPStatus.BAD_REQUEST:
exceptions.BadRequest.detect(description)
elif status_code == HTTPStatus.NOT_FOUND:
exceptions.NotFound.detect(description)

View file

@ -275,7 +275,7 @@ class Text(Filter):
('endswith', endswith)
] if arg[1] is not None])
raise ValueError(f"Arguments '{args}' cannot be used together.")
elif check == 0:
if check == 0:
raise ValueError(f"No one mode is specified!")
equals, contains, endswith, startswith = map(

View file

@ -70,7 +70,7 @@ async def check_filters(filters: typing.Iterable[FilterObj], args):
f = await execute_filter(filter_, args)
if not f:
raise FilterNotPassed()
elif isinstance(f, dict):
if isinstance(f, dict):
data.update(f)
return data

View file

@ -90,7 +90,7 @@ class CallbackData:
prefix, *parts = callback_data.split(self.sep)
if prefix != self.prefix:
raise ValueError("Passed callback data can't be parsed with that prefix.")
elif len(parts) != len(self._part_names):
if len(parts) != len(self._part_names):
raise ValueError('Invalid parts count!')
result = {'@': prefix}