mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
ruff: Fix SIM118 Use k not in d
instead of k not in d.keys()
.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 74d6d76046
)
This commit is contained in:
committed by
Alex Vandiver
parent
91e5ef39eb
commit
323223db4c
@@ -873,7 +873,7 @@ def check_realm_update(
|
|||||||
assert "extra_data" in event
|
assert "extra_data" in event
|
||||||
return
|
return
|
||||||
|
|
||||||
assert "extra_data" not in event.keys()
|
assert "extra_data" not in event
|
||||||
|
|
||||||
if prop in ["notifications_stream_id", "signup_notifications_stream_id", "org_type"]:
|
if prop in ["notifications_stream_id", "signup_notifications_stream_id", "org_type"]:
|
||||||
assert isinstance(value, int)
|
assert isinstance(value, int)
|
||||||
@@ -1474,7 +1474,7 @@ def check_update_display_settings(
|
|||||||
if setting_name == "default_language":
|
if setting_name == "default_language":
|
||||||
assert "language_name" in event
|
assert "language_name" in event
|
||||||
else:
|
else:
|
||||||
assert "language_name" not in event.keys()
|
assert "language_name" not in event
|
||||||
|
|
||||||
|
|
||||||
def check_user_settings_update(
|
def check_user_settings_update(
|
||||||
@@ -1495,7 +1495,7 @@ def check_user_settings_update(
|
|||||||
if setting_name == "default_language":
|
if setting_name == "default_language":
|
||||||
assert "language_name" in event
|
assert "language_name" in event
|
||||||
else:
|
else:
|
||||||
assert "language_name" not in event.keys()
|
assert "language_name" not in event
|
||||||
|
|
||||||
|
|
||||||
update_global_notifications_event = event_dict_type(
|
update_global_notifications_event = event_dict_type(
|
||||||
|
@@ -65,9 +65,9 @@ def validate_external_account_field_data(field_data: ProfileFieldData) -> Profil
|
|||||||
field_validator("field_data", field_data)
|
field_validator("field_data", field_data)
|
||||||
|
|
||||||
field_subtype = field_data.get("subtype")
|
field_subtype = field_data.get("subtype")
|
||||||
if field_subtype not in DEFAULT_EXTERNAL_ACCOUNTS.keys():
|
if field_subtype not in DEFAULT_EXTERNAL_ACCOUNTS:
|
||||||
if field_subtype == "custom":
|
if field_subtype == "custom":
|
||||||
if "url_pattern" not in field_data.keys():
|
if "url_pattern" not in field_data:
|
||||||
raise ValidationError(_("Custom external account must define URL pattern"))
|
raise ValidationError(_("Custom external account must define URL pattern"))
|
||||||
else:
|
else:
|
||||||
raise ValidationError(_("Invalid external account type"))
|
raise ValidationError(_("Invalid external account type"))
|
||||||
|
@@ -398,7 +398,7 @@ def validate_against_openapi_schema(
|
|||||||
# No 500 responses have been documented, so skip them
|
# No 500 responses have been documented, so skip them
|
||||||
if status_code.startswith("5"):
|
if status_code.startswith("5"):
|
||||||
return False
|
return False
|
||||||
if path not in openapi_spec.openapi()["paths"].keys():
|
if path not in openapi_spec.openapi()["paths"]:
|
||||||
endpoint = find_openapi_endpoint(path)
|
endpoint = find_openapi_endpoint(path)
|
||||||
# If it doesn't match it hasn't been documented yet.
|
# If it doesn't match it hasn't been documented yet.
|
||||||
if endpoint is None:
|
if endpoint is None:
|
||||||
|
@@ -62,7 +62,7 @@ def format_object(
|
|||||||
subject_type: str,
|
subject_type: str,
|
||||||
message: str,
|
message: str,
|
||||||
) -> str:
|
) -> str:
|
||||||
if subject_type not in subject_types.keys():
|
if subject_type not in subject_types:
|
||||||
return message
|
return message
|
||||||
keys: List[List[str]] = subject_types[subject_type][1:]
|
keys: List[List[str]] = subject_types[subject_type][1:]
|
||||||
title = subject_types[subject_type][0]
|
title = subject_types[subject_type][0]
|
||||||
|
Reference in New Issue
Block a user