-
Notifications
You must be signed in to change notification settings - Fork 23
Open

Description
I know it's against every styleguide, but black insists on reformatting this function of mine and the result is much worse than if it would just not.
Before:
def run_json_cmd(cmd: Cmd, stderr=stderr) -> Jsonish:
from shlex import quote
stderr.write(" ".join(("+",) + tuple(quote(arg) for arg in cmd)))
stderr.write("\n")
from subprocess import check_output
output = check_output(cmd)
from json import loads
return loads(output)
After:
def run_json_cmd(cmd: Cmd, stderr=stderr) -> Jsonish:
from shlex import quote
stderr.write(" ".join(("+",) + tuple(quote(arg) for arg in cmd)))
stderr.write("\n")
from subprocess import check_output
output = check_output(cmd)
from json import loads
return loads(output)
P.S. This is the prelude in both cases, just in case anyone wants it:
from sys import stderr
from typing import Union, List, Dict, Tuple
Jsonish = Union[
None, int, float, str, bool, List["Jsonish"], Dict[str, "Jsonish"]
]
Cmd = tuple[Arg, ...]
Metadata
Metadata
Assignees
Labels
No labels