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 FURB171 Membership test against single-item container.

Anders Kaseorg0c1224c22826
diff --git a/tools/lib/provision.py b/tools/lib/provision.py
index dfef6f778da..0ff42959f61 100755
--- a/tools/lib/provision.py
+++ b/tools/lib/provision.py
@@ -152,7 +152,7 @@ COMMON_YUM_DEPENDENCIES = [
BUILD_GROONGA_FROM_SOURCE = False
BUILD_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 = True
diff --git a/tools/lib/template_parser.py b/tools/lib/template_parser.py
index 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 += 1
return 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 += 1
return s
diff --git a/zerver/actions/presence.py b/zerver/actions/presence.py
index 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 client
diff --git a/zerver/lib/emoji.py b/zerver/lib/emoji.py
index 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_ty
if 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.py
index 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 False
elif operator == "is" and operand == "unread":
diff --git a/zerver/lib/url_decoding.py b/zerver/lib/url_decoding.py
index 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.py
index 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)