qtoolkit.host.base module#

class qtoolkit.host.base.BaseHost(config: HostConfig | None = None)[source]#

Bases: QTKObject

Base Host class.

abstractmethod execute(command: str | list[str], workdir: str | Path | None = None) tuple[str, str, int][source]#

Execute the given command on the host.

Parameters:
  • command (str or list of str) – Command to execute, as a str or list of str

  • workdir (str or None) – path where the command will be executed.

Returns:

Standard output, standard error, and exit code of the command.

Return type:

tuple[str, str, int]

abstractmethod mkdir(directory: str | Path, recursive: bool = True, exist_ok: bool = True) bool[source]#

Create directory on the host.

abstractmethod write_text_file(filepath: str | Path, content: str) None[source]#

Write content to a file on the host.

class qtoolkit.host.base.HostConfig(root_dir: 'str | Path')[source]#

Bases: QTKObject

root_dir: str | Path#