ruff: Fix RUF005 Consider unpacking instead of concatenation.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-10-30 10:56:34 -07:00
parent 12e63f493f
commit 610683ea41
4 changed files with 5 additions and 6 deletions

View file

@ -123,7 +123,7 @@ files_dict = lister.list_files(
ftypes=["py", "pyi"], ftypes=["py", "pyi"],
use_shebang=True, use_shebang=True,
modified_only=args.modified, modified_only=args.modified,
exclude=exclude + ["stubs"], exclude=[*exclude, "stubs"],
group_by_ftype=True, group_by_ftype=True,
) )
@ -154,7 +154,7 @@ status = 0
for repo, python_files in repo_python_files.items(): for repo, python_files in repo_python_files.items():
print(f"Running mypy for `{repo}`.", flush=True) print(f"Running mypy for `{repo}`.", flush=True)
if python_files: if python_files:
result = subprocess.call([mypy_command, "--"] + python_files) result = subprocess.call([mypy_command, "--", *python_files])
if result != 0: if result != 0:
status = result status = result
else: else:

View file

@ -66,7 +66,7 @@ def new_temp_dir() -> Iterator[str]:
class MatrixBridgeScriptTests(TestCase): class MatrixBridgeScriptTests(TestCase):
def output_from_script(self, options: List[str]) -> List[str]: def output_from_script(self, options: List[str]) -> List[str]:
popen = Popen( popen = Popen(
[sys.executable, script] + options, stdin=PIPE, stdout=PIPE, universal_newlines=True [sys.executable, script, *options], stdin=PIPE, stdout=PIPE, universal_newlines=True
) )
return popen.communicate()[0].strip().split("\n") return popen.communicate()[0].strip().split("\n")

View file

@ -719,7 +719,7 @@ def send_authed_zephyr(zwrite_args: List[str], content: str) -> Tuple[int, str]:
def send_unauthed_zephyr(zwrite_args: List[str], content: str) -> Tuple[int, str]: def send_unauthed_zephyr(zwrite_args: List[str], content: str) -> Tuple[int, str]:
return send_zephyr(zwrite_args + ["-d"], content) return send_zephyr([*zwrite_args, "-d"], content)
def zcrypt_encrypt_content(zephyr_class: str, instance: str, content: str) -> Optional[str]: def zcrypt_encrypt_content(zephyr_class: str, instance: str, content: str) -> Optional[str]:

View file

@ -57,8 +57,7 @@ def get_bot_converter_response(message: Dict[str, str], bot_handler: BotHandler)
content = message["content"] content = message["content"]
words = content.lower().split() words = content.lower().split()
convert_indexes = [i for i, word in enumerate(words) if word == "@convert"] convert_indexes = [-1, *(i for i, word in enumerate(words) if word == "@convert")]
convert_indexes = [-1] + convert_indexes
results = [] results = []
for convert_index in convert_indexes: for convert_index in convert_indexes: