Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ruff: Fix FURB171 Membership test against single-item container.
Anders Kaseorg0c1224c22826
diff --git a/tools/lib/provision.py b/tools/lib/provision.pyindex dfef6f778da..0ff42959f61 100755--- a/tools/lib/provision.py+++ b/tools/lib/provision.py@@ -152,7 +152,7 @@ COMMON_YUM_DEPENDENCIES = [BUILD_GROONGA_FROM_SOURCE = FalseBUILD_PGROONGA_FROM_SOURCE = False-if (vendor == "debian" and os_version in ["13"]) or (vendor == "ubuntu" and os_version in []):+if (vendor == "debian" and os_version == "13") or (vendor == "ubuntu" and os_version in []):# For platforms without a PGroonga release, we need to build it# from source.BUILD_PGROONGA_FROM_SOURCE = Truediff --git a/tools/lib/template_parser.py b/tools/lib/template_parser.pyindex 4c046891bce..5f4f945e851 100644--- a/tools/lib/template_parser.py+++ b/tools/lib/template_parser.py@@ -669,7 +669,7 @@ def get_handlebars_triple_stache_tag(text: str, i: int) -> str:def get_spaces(text: str, i: int) -> str:s = ""- while i < len(text) and text[i] in " ":+ while i < len(text) and text[i] == " ":s += text[i]i += 1return s@@ -677,7 +677,7 @@ def get_spaces(text: str, i: int) -> str:def get_code(text: str, i: int) -> str:s = ""- while i < len(text) and text[i] not in "<":+ while i < len(text) and text[i] != "<":s += text[i]i += 1return sdiff --git a/zerver/actions/presence.py b/zerver/actions/presence.pyindex b7548e46396..f6978bfad4d 100644--- a/zerver/actions/presence.py+++ b/zerver/actions/presence.py@@ -84,7 +84,7 @@ def consolidate_client(client: Client) -> Client:# to count as web users# Alias ZulipDesktop to website- if client.name in ["ZulipDesktop"]:+ if client.name == "ZulipDesktop":return get_client("website")else:return clientdiff --git a/zerver/lib/emoji.py b/zerver/lib/emoji.pyindex f256e494977..766c1e29715 100644--- a/zerver/lib/emoji.py+++ b/zerver/lib/emoji.py@@ -104,7 +104,7 @@ def check_emoji_request(realm: Realm, emoji_name: str, emoji_code: str, emoji_tyif realm_emoji["deactivated"]:raise JsonableError(_("This custom emoji has been deactivated."))elif emoji_type == "zulip_extra_emoji":- if emoji_code not in ["zulip"]:+ if emoji_code != "zulip":raise JsonableError(_("Invalid emoji code."))if emoji_name != emoji_code:raise JsonableError(_("Invalid emoji name."))diff --git a/zerver/lib/narrow_predicate.py b/zerver/lib/narrow_predicate.pyindex a6d1390e536..04101932841 100644--- a/zerver/lib/narrow_predicate.py+++ b/zerver/lib/narrow_predicate.py@@ -57,7 +57,7 @@ def build_narrow_predicate(# "is:private" is a legacy alias for "is:dm"if message["type"] != "private":return False- elif operator == "is" and operand in ["starred"]:+ elif operator == "is" and operand == "starred":if operand not in flags:return Falseelif operator == "is" and operand == "unread":diff --git a/zerver/lib/url_decoding.py b/zerver/lib/url_decoding.pyindex d5629421475..aa60e2df2be 100644--- a/zerver/lib/url_decoding.py+++ b/zerver/lib/url_decoding.py@@ -135,7 +135,7 @@ def parse_narrow_url(raw_operand = ""operand = decode_narrow_operand(operator, raw_operand)- if operand == "" and operator not in ["topic"]:+ if operand == "" and operator != "topic":# The empty string is a valid topic (realm_empty_topic_display_name).## Other empty string operands are invalid.diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex 0e83d92c36e..889266da321 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -2921,7 +2921,7 @@ class StreamAdminTest(ZulipTestCase):self.assert_length(cache_tries, cache_count)# If the removal succeeded, assert all target users are no longer subscribed.- if result.status_code not in [400]:+ if result.status_code != 400:subbed_users = self.users_subscribed_to_stream(stream_name, user_profile.realm)for user in target_users:self.assertNotIn(user, subbed_users)