ruff: Fix UP038 Use X | Y in isinstance call instead of (X, Y).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-07-11 17:30:27 -07:00
committed by Tim Abbott
parent 0fa5e7f629
commit 1464009fae
7 changed files with 10 additions and 10 deletions

View File

@@ -624,7 +624,7 @@ def check_string_or_int_list(var_name: str, val: object) -> str | list[int]:
def check_string_or_int(var_name: str, val: object) -> str | int:
if isinstance(val, (str, int)):
if isinstance(val, str | int):
return val
raise ValidationError(_("{var_name} is not a string or integer").format(var_name=var_name))
@@ -654,7 +654,7 @@ class WildValue:
return self.value == other
def __len__(self) -> int:
if not isinstance(self.value, (dict, list, str)):
if not isinstance(self.value, dict | list | str):
raise ValidationError(
_("{var_name} does not have a length").format(var_name=self.var_name)
)