python: Use ‘not in’ for negated membership tests

Fixes “E713 Test for membership should be `not in`” found by
ruff (https://github.com/charliermarsh/ruff).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-09-16 18:20:47 -07:00 committed by Tim Abbott
parent 83523328c9
commit 403837e52d
2 changed files with 2 additions and 2 deletions

View File

@ -129,7 +129,7 @@ def check_other_queues(queue_counts_dict: Dict[str, int]) -> List[Dict[str, Any]
def check_rabbitmq_queues() -> None: def check_rabbitmq_queues() -> None:
pattern = re.compile(r"(\w+)\t(\d+)\t(\d+)") pattern = re.compile(r"(\w+)\t(\d+)\t(\d+)")
if "USER" in os.environ and not os.environ["USER"] in ["root", "rabbitmq"]: if "USER" in os.environ and os.environ["USER"] not in ["root", "rabbitmq"]:
print("This script must be run as the root or rabbitmq user") print("This script must be run as the root or rabbitmq user")
list_queues_output = subprocess.check_output( list_queues_output = subprocess.check_output(

View File

@ -1193,7 +1193,7 @@ def apply_event(
state["starred_messages"] = [ state["starred_messages"] = [
message message
for message in state["starred_messages"] for message in state["starred_messages"]
if not (message in event["messages"]) if message not in event["messages"]
] ]
elif event["type"] == "realm_domains": elif event["type"] == "realm_domains":
if event["op"] == "add": if event["op"] == "add":