mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Refactor unnecessary else / elif when if block has a raise statement
This commit is contained in:
parent
44a07f26ed
commit
7ca09aac1b
4 changed files with 5 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue