Skip to content

Commit

Permalink
feat: import CalledProcessError for users of run_command
Browse files Browse the repository at this point in the history
chore: fix typing of cmd_args
  • Loading branch information
Jean-Louis Fuchs committed Mar 3, 2024
1 parent aa82c4d commit 3618162
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyaptly/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import logging
import subprocess
from pathlib import Path
from subprocess import DEVNULL, PIPE # noqa: F401
from typing import Optional, Union
from subprocess import DEVNULL, PIPE, CalledProcessError # noqa: F401
from typing import Optional, Sequence

_DEFAULT_KEYSERVER: str = "hkps://keys.openpgp.org"
_PYTEST_KEYSERVER: Optional[str] = None
Expand Down Expand Up @@ -51,7 +51,7 @@ def is_debug_mode():
return _DEBUG or _PYTEST_DEBUG


def run_command(cmd_args: list[Union[str, Path]], *, decode: bool = True, **kwargs):
def run_command(cmd_args: Sequence[str | Path], *, decode: bool = True, **kwargs):
"""Instrumented subprocess.run for easier debugging.
By default this run command will add `encoding="UTF-8"` to kwargs. Disable
Expand Down Expand Up @@ -83,7 +83,7 @@ def run_command(cmd_args: list[Union[str, Path]], *, decode: bool = True, **kwar
return result


def indent_out(output: Union[bytes, str]) -> str:
def indent_out(output: bytes | str) -> str:
"""Indent command output for nicer logging-messages.
It will convert bytes to strings if need or display the result as bytes if
Expand Down

0 comments on commit 3618162

Please sign in to comment.