python: Fix PAR002 Dont use parentheses for unpacking.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
059458b4ca
commit
6aedfe6457
8 changed files with 21 additions and 21 deletions
|
@ -372,7 +372,7 @@ option does not affect login credentials.""".replace("\n", " "),
|
|||
|
||||
parser.add_option_group(jabber_group)
|
||||
parser.add_option_group(zulip.generate_option_group(parser, "zulip-"))
|
||||
(options, args) = parser.parse_args()
|
||||
options, args = parser.parse_args()
|
||||
|
||||
logging.basicConfig(level=options.log_level, format="%(levelname)-8s %(message)s")
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ parser = optparse.OptionParser()
|
|||
parser.add_option("--verbose", dest="verbose", default=False, action="store_true")
|
||||
parser.add_option("--site", dest="site", default=None, action="store")
|
||||
parser.add_option("--sharded", default=False, action="store_true")
|
||||
(options, args) = parser.parse_args()
|
||||
options, args = parser.parse_args()
|
||||
|
||||
mit_user = "tabbott/extra@ATHENA.MIT.EDU"
|
||||
|
||||
|
@ -331,8 +331,8 @@ z_contents = [
|
|||
notice.z_message[: notice.z_message_len].split(b"\0")[1].decode(errors="replace")
|
||||
for notice in notices
|
||||
]
|
||||
(h_key_counts, h_missing_z, h_missing_h, h_duplicates, h_success) = process_keys(h_contents)
|
||||
(z_key_counts, z_missing_z, z_missing_h, z_duplicates, z_success) = process_keys(z_contents)
|
||||
h_key_counts, h_missing_z, h_missing_h, h_duplicates, h_success = process_keys(h_contents)
|
||||
z_key_counts, z_missing_z, z_missing_h, z_duplicates, z_success = process_keys(z_contents)
|
||||
|
||||
for notice in notices:
|
||||
zephyr_ctypes.ZFreeNotice(byref(notice))
|
||||
|
@ -350,7 +350,7 @@ for key in all_keys:
|
|||
if z_key_counts[key] == 1 and h_key_counts[key] == 1:
|
||||
continue
|
||||
if key in zhkeys:
|
||||
(stream, test) = zhkeys[key]
|
||||
stream, test = zhkeys[key]
|
||||
logger.warning(
|
||||
"%10s: z got %s, h got %s. Sent via Zephyr(%s): class %s",
|
||||
key,
|
||||
|
@ -360,7 +360,7 @@ for key in all_keys:
|
|||
stream,
|
||||
)
|
||||
if key in hzkeys:
|
||||
(stream, test) = hzkeys[key]
|
||||
stream, test = hzkeys[key]
|
||||
logger.warning(
|
||||
"%10s: z got %s. h got %s. Sent via Zulip(%s): class %s",
|
||||
key,
|
||||
|
|
|
@ -12,7 +12,7 @@ from typing import Optional
|
|||
sys.path[:0] = [os.path.dirname(__file__)]
|
||||
from zephyr_mirror_backend import parse_args
|
||||
|
||||
(options, args) = parse_args()
|
||||
options, args = parse_args()
|
||||
|
||||
|
||||
def die(signal: int, frame: Optional[FrameType]) -> None:
|
||||
|
|
|
@ -53,9 +53,9 @@ def make_zulip_client() -> zulip.Client:
|
|||
|
||||
def to_zulip_username(zephyr_username: str) -> str:
|
||||
if "@" in zephyr_username:
|
||||
(user, realm) = zephyr_username.split("@")
|
||||
user, realm = zephyr_username.split("@")
|
||||
else:
|
||||
(user, realm) = (zephyr_username, "ATHENA.MIT.EDU")
|
||||
user, realm = (zephyr_username, "ATHENA.MIT.EDU")
|
||||
if realm.upper() == "ATHENA.MIT.EDU":
|
||||
# Hack to make ctl's fake username setup work :)
|
||||
if user.lower() == "golem":
|
||||
|
@ -65,7 +65,7 @@ def to_zulip_username(zephyr_username: str) -> str:
|
|||
|
||||
|
||||
def to_zephyr_username(zulip_username: str) -> str:
|
||||
(user, realm) = zulip_username.split("@")
|
||||
user, realm = zulip_username.split("@")
|
||||
if "|" not in user:
|
||||
# Hack to make ctl's fake username setup work :)
|
||||
if user.lower() == "ctl":
|
||||
|
@ -358,7 +358,7 @@ def process_loop(zulip_queue: "Queue[ZephyrDict]", log: Optional[IO[str]]) -> No
|
|||
|
||||
def parse_zephyr_body(zephyr_data: str, notice_format: str) -> Tuple[str, str]:
|
||||
try:
|
||||
(zsig, body) = zephyr_data.split("\x00", 1)
|
||||
zsig, body = zephyr_data.split("\x00", 1)
|
||||
if notice_format in (
|
||||
"New transaction [$1] entered in $2\nFrom: $3 ($5)\nSubject: $4",
|
||||
"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]:
|
|||
fields[3],
|
||||
)
|
||||
except ValueError:
|
||||
(zsig, body) = ("", zephyr_data)
|
||||
zsig, body = "", zephyr_data
|
||||
# Clean body of any null characters, since they're invalid in our protocol.
|
||||
body = body.replace("\x00", "")
|
||||
return (zsig, body)
|
||||
|
@ -448,7 +448,7 @@ def process_notice(
|
|||
notice: zephyr_ctypes.ZNotice_t, zulip_queue: "Queue[ZephyrDict]", log: Optional[IO[str]]
|
||||
) -> None:
|
||||
assert notice.z_sender is not None
|
||||
(zsig, body) = parse_zephyr_body(
|
||||
zsig, body = parse_zephyr_body(
|
||||
notice.z_message[: notice.z_message_len].decode(errors="replace"),
|
||||
notice.z_default_format.decode(errors="replace"),
|
||||
)
|
||||
|
@ -852,7 +852,7 @@ Zulip users (like you) received it, Zephyr users did not.
|
|||
logger.debug("Would have forwarded: %r\n%s", zwrite_args, wrapped_content)
|
||||
return
|
||||
|
||||
(code, stderr) = send_authed_zephyr(zwrite_args, wrapped_content)
|
||||
code, stderr = send_authed_zephyr(zwrite_args, wrapped_content)
|
||||
if code == 0 and stderr == "":
|
||||
return
|
||||
elif code == 0:
|
||||
|
@ -876,7 +876,7 @@ returned the following warning:
|
|||
):
|
||||
# Retry sending the message unauthenticated; if that works,
|
||||
# just notify the user that they need to renew their tickets
|
||||
(code, stderr) = send_unauthed_zephyr(zwrite_args, wrapped_content)
|
||||
code, stderr = send_unauthed_zephyr(zwrite_args, wrapped_content)
|
||||
if code == 0:
|
||||
if options.ignore_expired_tickets:
|
||||
return
|
||||
|
@ -1106,7 +1106,7 @@ def parse_zephyr_subs(verbose: bool = False) -> Set[Tuple[str, str, str]]:
|
|||
if len(line) == 0:
|
||||
continue
|
||||
try:
|
||||
(cls, instance, recipient) = line.split(",")
|
||||
cls, instance, recipient = line.split(",")
|
||||
cls = cls.replace("%me%", options.user)
|
||||
instance = instance.replace("%me%", options.user)
|
||||
recipient = recipient.replace("%me%", options.user)
|
||||
|
@ -1252,7 +1252,7 @@ if __name__ == "__main__":
|
|||
|
||||
signal.signal(signal.SIGINT, die_gracefully)
|
||||
|
||||
(options, args) = parse_args()
|
||||
options, args = parse_args()
|
||||
|
||||
logger = open_logger()
|
||||
configure_logger(logger, "parent")
|
||||
|
|
|
@ -743,7 +743,7 @@ class Client:
|
|||
# making a new long-polling request.
|
||||
while True:
|
||||
if queue_id is None:
|
||||
(queue_id, last_event_id) = do_register()
|
||||
queue_id, last_event_id = do_register()
|
||||
|
||||
try:
|
||||
res = self.get_events(queue_id=queue_id, last_event_id=last_event_id)
|
||||
|
|
|
@ -93,7 +93,7 @@ def get_translate_bot_response(message_content, config_file, author, all_languag
|
|||
split_text.append("")
|
||||
if len(split_text) != 3:
|
||||
return help_text
|
||||
(text_to_translate, target_language, source_language) = split_text
|
||||
text_to_translate, target_language, source_language = split_text
|
||||
text_to_translate = text_to_translate[1:]
|
||||
target_language = get_code_for_language(target_language, all_languages)
|
||||
if target_language == "":
|
||||
|
|
|
@ -34,7 +34,7 @@ class IncidentHandler:
|
|||
start_new_incident(query, message, bot_handler)
|
||||
elif query.startswith("answer "):
|
||||
try:
|
||||
(ticket_id, answer) = parse_answer(query)
|
||||
ticket_id, answer = parse_answer(query)
|
||||
except InvalidAnswerError:
|
||||
bot_response = "Invalid answer format"
|
||||
bot_handler.send_reply(message, bot_response)
|
||||
|
|
|
@ -35,7 +35,7 @@ class TriviaQuizHandler:
|
|||
return
|
||||
elif query.startswith("answer"):
|
||||
try:
|
||||
(quiz_id, answer) = parse_answer(query)
|
||||
quiz_id, answer = parse_answer(query)
|
||||
except InvalidAnswerError:
|
||||
bot_response = "Invalid answer format"
|
||||
bot_handler.send_reply(message, bot_response)
|
||||
|
|
Loading…
Add table
Reference in a new issue