Commit a8c63f05 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Rename PathArg to Argument

parent 664c64ea
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -34,11 +34,11 @@ from typing import Union
from typing import overload

from .json import JSONObject
from .proc import Argument
from .proc import Arguments
from .proc import Deserialiser
from .proc import Environ
from .proc import MutableArguments
from .proc import PathArg
from .proc import PathLike
from .proc import coerce_args
from .proc import exec_io
@@ -52,14 +52,14 @@ Volumes = Iterable[Mount]
DOCKER = "docker"


def docker(*args: PathArg, **env: str) -> None:
def docker(*args: Argument, **env: str) -> None:
	"""
	Run a Docker command, with output going to stdout
	"""
	run([DOCKER, *coerce_args(args)], env=env, check=True)


def docker_output(*args: PathArg, **env: str) -> str:
def docker_output(*args: Argument, **env: str) -> str:
	"""
	Run a Docker command, capturing and returning its stdout
	"""
@@ -67,7 +67,7 @@ def docker_output(*args: PathArg, **env: str) -> str:
	return proc.stdout.strip()


def docker_quiet(*args: PathArg, **env: str) -> None:
def docker_quiet(*args: Argument, **env: str) -> None:
	"""
	Run a Docker command, directing its stdout to /dev/null
	"""
@@ -175,7 +175,7 @@ class Container(Item):
		volumes: Volumes = [],
		env: Environ = {},
		network: Network|None = None,
		entrypoint: HostMount|PathArg|None = None,
		entrypoint: HostMount|Argument|None = None,
	):
		if isinstance(entrypoint, tuple):
			volumes = [*volumes, entrypoint]
@@ -405,14 +405,14 @@ class Cli:

	T = TypeVar("T")

	def __init__(self, container: Container, *cmd: PathArg):
	def __init__(self, container: Container, *cmd: Argument):
		self.container = container
		self.cmd = cmd

	@overload
	def __call__(
		self,
		*args: PathArg,
		*args: Argument,
		input: str|bytes|SupportsBytes|None = ...,
		deserialiser: Deserialiser[T],
		query: Literal[False] = False,
@@ -422,7 +422,7 @@ class Cli:
	@overload
	def __call__(
		self,
		*args: PathArg,
		*args: Argument,
		input: str|bytes|SupportsBytes|None = ...,
		deserialiser: None = None,
		query: Literal[True],
@@ -432,7 +432,7 @@ class Cli:
	@overload
	def __call__(
		self,
		*args: PathArg,
		*args: Argument,
		input: str|bytes|SupportsBytes|None = ...,
		deserialiser: None = None,
		query: Literal[False] = False,
@@ -441,7 +441,7 @@ class Cli:

	def __call__(
		self,
		*args: PathArg,
		*args: Argument,
		input: str|bytes|SupportsBytes|None = None,
		deserialiser: Deserialiser[Any]|None = None,
		query: bool = False,
+4 −3
Original line number Diff line number Diff line
@@ -32,9 +32,10 @@ T = TypeVar('T')
Deserialiser = Callable[[memoryview], T]

PathLike = os.PathLike[str]
PathArg = Union[PathLike, str]
Arguments = Sequence[PathArg]
MutableArguments = MutableSequence[PathArg]
Argument = Union[PathLike, str]
PathArg = Argument  # deprecated
Arguments = Sequence[Argument]
MutableArguments = MutableSequence[Argument]
Environ = Mapping[str, str]