Skip to content

Commit 6aedfe6

Browse files
committed
python: Fix PAR002 Dont use parentheses for unpacking.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 059458b commit 6aedfe6

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

zulip/integrations/jabber/jabber_mirror_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def config_error(msg: str) -> None:
372372

373373
parser.add_option_group(jabber_group)
374374
parser.add_option_group(zulip.generate_option_group(parser, "zulip-"))
375-
(options, args) = parser.parse_args()
375+
options, args = parser.parse_args()
376376

377377
logging.basicConfig(level=options.log_level, format="%(levelname)-8s %(message)s")
378378

zulip/integrations/zephyr/check-mirroring

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ parser = optparse.OptionParser()
1616
parser.add_option("--verbose", dest="verbose", default=False, action="store_true")
1717
parser.add_option("--site", dest="site", default=None, action="store")
1818
parser.add_option("--sharded", default=False, action="store_true")
19-
(options, args) = parser.parse_args()
19+
options, args = parser.parse_args()
2020

2121
mit_user = "tabbott/[email protected]"
2222

@@ -331,8 +331,8 @@ z_contents = [
331331
notice.z_message[: notice.z_message_len].split(b"\0")[1].decode(errors="replace")
332332
for notice in notices
333333
]
334-
(h_key_counts, h_missing_z, h_missing_h, h_duplicates, h_success) = process_keys(h_contents)
335-
(z_key_counts, z_missing_z, z_missing_h, z_duplicates, z_success) = process_keys(z_contents)
334+
h_key_counts, h_missing_z, h_missing_h, h_duplicates, h_success = process_keys(h_contents)
335+
z_key_counts, z_missing_z, z_missing_h, z_duplicates, z_success = process_keys(z_contents)
336336

337337
for notice in notices:
338338
zephyr_ctypes.ZFreeNotice(byref(notice))
@@ -350,7 +350,7 @@ for key in all_keys:
350350
if z_key_counts[key] == 1 and h_key_counts[key] == 1:
351351
continue
352352
if key in zhkeys:
353-
(stream, test) = zhkeys[key]
353+
stream, test = zhkeys[key]
354354
logger.warning(
355355
"%10s: z got %s, h got %s. Sent via Zephyr(%s): class %s",
356356
key,
@@ -360,7 +360,7 @@ for key in all_keys:
360360
stream,
361361
)
362362
if key in hzkeys:
363-
(stream, test) = hzkeys[key]
363+
stream, test = hzkeys[key]
364364
logger.warning(
365365
"%10s: z got %s. h got %s. Sent via Zulip(%s): class %s",
366366
key,

zulip/integrations/zephyr/zephyr_mirror.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
sys.path[:0] = [os.path.dirname(__file__)]
1313
from zephyr_mirror_backend import parse_args
1414

15-
(options, args) = parse_args()
15+
options, args = parse_args()
1616

1717

1818
def die(signal: int, frame: Optional[FrameType]) -> None:

zulip/integrations/zephyr/zephyr_mirror_backend.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ def make_zulip_client() -> zulip.Client:
5353

5454
def to_zulip_username(zephyr_username: str) -> str:
5555
if "@" in zephyr_username:
56-
(user, realm) = zephyr_username.split("@")
56+
user, realm = zephyr_username.split("@")
5757
else:
58-
(user, realm) = (zephyr_username, "ATHENA.MIT.EDU")
58+
user, realm = (zephyr_username, "ATHENA.MIT.EDU")
5959
if realm.upper() == "ATHENA.MIT.EDU":
6060
# Hack to make ctl's fake username setup work :)
6161
if user.lower() == "golem":
@@ -65,7 +65,7 @@ def to_zulip_username(zephyr_username: str) -> str:
6565

6666

6767
def to_zephyr_username(zulip_username: str) -> str:
68-
(user, realm) = zulip_username.split("@")
68+
user, realm = zulip_username.split("@")
6969
if "|" not in user:
7070
# Hack to make ctl's fake username setup work :)
7171
if user.lower() == "ctl":
@@ -358,7 +358,7 @@ def process_loop(zulip_queue: "Queue[ZephyrDict]", log: Optional[IO[str]]) -> No
358358

359359
def parse_zephyr_body(zephyr_data: str, notice_format: str) -> Tuple[str, str]:
360360
try:
361-
(zsig, body) = zephyr_data.split("\x00", 1)
361+
zsig, body = zephyr_data.split("\x00", 1)
362362
if notice_format in (
363363
"New transaction [$1] entered in $2\nFrom: $3 ($5)\nSubject: $4",
364364
"New transaction [$1] entered in $2\nFrom: $3\nSubject: $4",
@@ -374,7 +374,7 @@ def parse_zephyr_body(zephyr_data: str, notice_format: str) -> Tuple[str, str]:
374374
fields[3],
375375
)
376376
except ValueError:
377-
(zsig, body) = ("", zephyr_data)
377+
zsig, body = "", zephyr_data
378378
# Clean body of any null characters, since they're invalid in our protocol.
379379
body = body.replace("\x00", "")
380380
return (zsig, body)
@@ -448,7 +448,7 @@ def process_notice(
448448
notice: zephyr_ctypes.ZNotice_t, zulip_queue: "Queue[ZephyrDict]", log: Optional[IO[str]]
449449
) -> None:
450450
assert notice.z_sender is not None
451-
(zsig, body) = parse_zephyr_body(
451+
zsig, body = parse_zephyr_body(
452452
notice.z_message[: notice.z_message_len].decode(errors="replace"),
453453
notice.z_default_format.decode(errors="replace"),
454454
)
@@ -852,7 +852,7 @@ class and your mirroring bot does not have access to the relevant \
852852
logger.debug("Would have forwarded: %r\n%s", zwrite_args, wrapped_content)
853853
return
854854

855-
(code, stderr) = send_authed_zephyr(zwrite_args, wrapped_content)
855+
code, stderr = send_authed_zephyr(zwrite_args, wrapped_content)
856856
if code == 0 and stderr == "":
857857
return
858858
elif code == 0:
@@ -876,7 +876,7 @@ class and your mirroring bot does not have access to the relevant \
876876
):
877877
# Retry sending the message unauthenticated; if that works,
878878
# just notify the user that they need to renew their tickets
879-
(code, stderr) = send_unauthed_zephyr(zwrite_args, wrapped_content)
879+
code, stderr = send_unauthed_zephyr(zwrite_args, wrapped_content)
880880
if code == 0:
881881
if options.ignore_expired_tickets:
882882
return
@@ -1106,7 +1106,7 @@ def parse_zephyr_subs(verbose: bool = False) -> Set[Tuple[str, str, str]]:
11061106
if len(line) == 0:
11071107
continue
11081108
try:
1109-
(cls, instance, recipient) = line.split(",")
1109+
cls, instance, recipient = line.split(",")
11101110
cls = cls.replace("%me%", options.user)
11111111
instance = instance.replace("%me%", options.user)
11121112
recipient = recipient.replace("%me%", options.user)
@@ -1252,7 +1252,7 @@ def die_gracefully(signal: int, frame: Optional[FrameType]) -> None:
12521252

12531253
signal.signal(signal.SIGINT, die_gracefully)
12541254

1255-
(options, args) = parse_args()
1255+
options, args = parse_args()
12561256

12571257
logger = open_logger()
12581258
configure_logger(logger, "parent")

zulip/zulip/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ def do_register() -> Tuple[str, int]:
743743
# making a new long-polling request.
744744
while True:
745745
if queue_id is None:
746-
(queue_id, last_event_id) = do_register()
746+
queue_id, last_event_id = do_register()
747747

748748
try:
749749
res = self.get_events(queue_id=queue_id, last_event_id=last_event_id)

zulip_bots/zulip_bots/bots/google_translate/google_translate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def get_translate_bot_response(message_content, config_file, author, all_languag
9393
split_text.append("")
9494
if len(split_text) != 3:
9595
return help_text
96-
(text_to_translate, target_language, source_language) = split_text
96+
text_to_translate, target_language, source_language = split_text
9797
text_to_translate = text_to_translate[1:]
9898
target_language = get_code_for_language(target_language, all_languages)
9999
if target_language == "":

zulip_bots/zulip_bots/bots/incident/incident.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def handle_message(self, message: Dict[str, Any], bot_handler: BotHandler) -> No
3434
start_new_incident(query, message, bot_handler)
3535
elif query.startswith("answer "):
3636
try:
37-
(ticket_id, answer) = parse_answer(query)
37+
ticket_id, answer = parse_answer(query)
3838
except InvalidAnswerError:
3939
bot_response = "Invalid answer format"
4040
bot_handler.send_reply(message, bot_response)

zulip_bots/zulip_bots/bots/trivia_quiz/trivia_quiz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def handle_message(self, message: Dict[str, Any], bot_handler: BotHandler) -> No
3535
return
3636
elif query.startswith("answer"):
3737
try:
38-
(quiz_id, answer) = parse_answer(query)
38+
quiz_id, answer = parse_answer(query)
3939
except InvalidAnswerError:
4040
bot_response = "Invalid answer format"
4141
bot_handler.send_reply(message, bot_response)

0 commit comments

Comments
 (0)