Loading behave_utils/proc.py +14 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ from __future__ import annotations import io import sys from copy import copy from os import PathLike from os import fspath from os import write as fdwrite Loading Loading @@ -174,6 +175,7 @@ class Executor(list[Argument]): """ T = TypeVar("T") E = TypeVar("E", bound="Executor") def __init__(self, *cmd: Argument): self[:] = cmd Loading Loading @@ -277,3 +279,15 @@ class Executor(list[Argument]): Override to amend command arguments and kwargs for exec_io() prior to execution """ return cmd def subcommand(self: E, *args: Argument) -> E: """ Return a new Executor instance of the same class with additional arguments appended The returned instance is created as a shallow copy; if attribute values need to be copied, subclasses must implement __copy__(). (see https://docs.python.org/3/library/copy.html) """ new = copy(self) new.extend(args) return new Loading
behave_utils/proc.py +14 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ from __future__ import annotations import io import sys from copy import copy from os import PathLike from os import fspath from os import write as fdwrite Loading Loading @@ -174,6 +175,7 @@ class Executor(list[Argument]): """ T = TypeVar("T") E = TypeVar("E", bound="Executor") def __init__(self, *cmd: Argument): self[:] = cmd Loading Loading @@ -277,3 +279,15 @@ class Executor(list[Argument]): Override to amend command arguments and kwargs for exec_io() prior to execution """ return cmd def subcommand(self: E, *args: Argument) -> E: """ Return a new Executor instance of the same class with additional arguments appended The returned instance is created as a shallow copy; if attribute values need to be copied, subclasses must implement __copy__(). (see https://docs.python.org/3/library/copy.html) """ new = copy(self) new.extend(args) return new