ruff: Fix SIM102 nested if statements.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-01-17 20:59:37 -05:00
committed by Tim Abbott
parent 50cf9bc4b8
commit b0e569f07c
38 changed files with 333 additions and 327 deletions

View File

@@ -48,11 +48,10 @@ def get_push_branch_name(payload: WildValue) -> str:
def get_event_name(payload: WildValue, branches: Optional[str]) -> Optional[str]:
event_name = payload["event"]["name"].tame(check_string)
if event_name == "repo-push":
if branches is not None:
branch = get_push_branch_name(payload)
if branches.find(branch) == -1:
return None
if event_name == "repo-push" and branches is not None:
branch = get_push_branch_name(payload)
if branches.find(branch) == -1:
return None
if event_name in EVENT_FUNCTION_MAPPER:
return event_name
raise UnsupportedWebhookEventTypeError(event_name)