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"],
use_shebang=True,
modified_only=args.modified,
exclude=exclude + ["stubs"],
exclude=[*exclude, "stubs"],
group_by_ftype=True,
)
@ -154,7 +154,7 @@ status = 0
for repo, python_files in repo_python_files.items():
print(f"Running mypy for `{repo}`.", flush=True)
if python_files:
result = subprocess.call([mypy_command, "--"] + python_files)
result = subprocess.call([mypy_command, "--", *python_files])
if result != 0:
status = result
else:

View file

@ -66,7 +66,7 @@ def new_temp_dir() -> Iterator[str]:
class MatrixBridgeScriptTests(TestCase):
def output_from_script(self, options: List[str]) -> List[str]:
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")

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]:
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]:

View file

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