Skip to content

Commit 5c934e5

Browse files
committed
ruff: Fix PLR1722 Use sys.exit() instead of exit.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 93bb7eb commit 5c934e5

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

zulip/integrations/bridge_with_irc/irc_mirror_backend.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import multiprocessing as mp
2+
import sys
23
from typing import Any, Dict
34

45
import irc.bot
@@ -47,13 +48,13 @@ def check_subscription_or_die(self) -> None:
4748
resp = self.zulip_client.get_subscriptions()
4849
if resp["result"] != "success":
4950
print("ERROR: {}".format(resp["msg"]))
50-
exit(1)
51+
sys.exit(1)
5152
subs = [s["name"] for s in resp["subscriptions"]]
5253
if self.stream not in subs:
5354
print(
5455
f"The bot is not yet subscribed to stream '{self.stream}'. Please subscribe the bot to the stream first."
5556
)
56-
exit(1)
57+
sys.exit(1)
5758

5859
def on_nicknameinuse(self, c: ServerConnection, e: Event) -> None:
5960
c.nick(c.get_nickname().replace("_zulip", "__zulip"))

zulip/integrations/bridge_with_slack/run-slack-bridge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ if __name__ == "__main__":
143143
'The key "channel_mapping" is not found in bridge_with_slack_config.py.\n'
144144
"Your config file may be outdated."
145145
)
146-
exit(1)
146+
sys.exit(1)
147147

148148
print("Starting slack mirroring bot")
149149
print("MAKE SURE THE BOT IS SUBSCRIBED TO THE RELEVANT ZULIP STREAM(S) & SLACK CHANNEL(S)!")

zulip/integrations/codebase/zulip_codebase_mirror

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ try:
2222
except ImportError as e:
2323
print(e, file=sys.stderr)
2424
print("Please install the python-dateutil package.", file=sys.stderr)
25-
exit(1)
25+
sys.exit(1)
2626

2727
sys.path.insert(0, os.path.dirname(__file__))
2828
import zulip_codebase_config as config

zulip/integrations/rss/rss-bot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ try:
112112
except OSError:
113113
# We can't write to the logfile, so just print and give up.
114114
print(f"Unable to store RSS data at {opts.data_dir}.", file=sys.stderr)
115-
exit(1)
115+
sys.exit(1)
116116

117117
log_file = os.path.join(opts.data_dir, "rss-bot.log")
118118
log_format = "%(asctime)s: %(message)s"
@@ -130,7 +130,7 @@ logger.addHandler(file_handler)
130130
def log_error_and_exit(error: str) -> None:
131131
logger.error(error)
132132
logger.error(usage)
133-
exit(1)
133+
sys.exit(1)
134134

135135

136136
class MLStripper(HTMLParser):

zulip/zulip/examples/get-history

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
import argparse
33
import json
4+
import sys
45
from typing import Any, Dict, List
56

67
import zulip
@@ -56,7 +57,7 @@ while not found_newest:
5657
# Might occur when the request is not returned with a success status
5758
print("Error occured: Payload was:")
5859
print(result)
59-
quit()
60+
sys.exit()
6061

6162
with open(options.filename, "w+") as f:
6263
print("Writing %d messages..." % len(all_messages))

0 commit comments

Comments
 (0)