Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ruff: Fix PLR1701 Consider merging these isinstance calls.

Anders Kaseorg4e9cced32bd4
diff --git a/zerver/lib/data_types.py b/zerver/lib/data_types.py
index 4897cacc09e..7db4d49222b 100644
--- a/zerver/lib/data_types.py
+++ b/zerver/lib/data_types.py
@@ -111,7 +111,7 @@ class NumberType:
OpenAPI, because isinstance(4, float) == False"""
def check_data(self, var_name: str, val: Optional[Any]) -> None:
- if isinstance(val, int) or isinstance(val, float):
+ if isinstance(val, (int, float)):
return
raise AssertionError(f"{var_name} is not a number")
@@ -183,7 +183,7 @@ class TupleType:
sub_types: Sequence[Any]
def check_data(self, var_name: str, val: Any) -> None:
- if not (isinstance(val, list) or isinstance(val, tuple)):
+ if not isinstance(val, (list, tuple)):
raise AssertionError(f"{var_name} is not a list/tuple")
if len(val) != len(self.sub_types):