ngs_tools.binary.Binary

Module Contents

Classes

BinaryResult

Typed version of namedtuple.

Binary

Wrapper around a binary file that provides a object-oriented interface to

BinaryExecutor

Class that handles execution of binaries with specified arguments.

exception ngs_tools.binary.Binary.BinaryError

Bases: Exception

Common base class for all non-exit exceptions.

class ngs_tools.binary.Binary.BinaryResult

Bases: NamedTuple

Typed version of namedtuple.

Usage in Python versions >= 3.6:

class Employee(NamedTuple):
    name: str
    id: int

This is equivalent to:

Employee = collections.namedtuple('Employee', ['name', 'id'])

The resulting class has extra __annotations__ and _field_types attributes, giving an ordered dict mapping field names to types. __annotations__ should be preferred, while _field_types is kept to maintain pre PEP 526 compatibility. (The field names are in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:

Employee = NamedTuple('Employee', name=str, id=int)

In Python versions <= 3.5 use:

Employee = NamedTuple('Employee', [('name', str), ('id', int)])
command: List[str]
process: subprocess.Popen
stdout: Optional[str]
stderr: Optional[str]
class ngs_tools.binary.Binary.Binary(path: str)

Wrapper around a binary file that provides a object-oriented interface to run_executable().

property path: str
__str__() str

Return str(self).

pre_execute(command: str, *args, **kwargs)
post_execute(command: str, result: BinaryResult, *args, **kwargs)
__call__(command: List[str], *args, **kwargs) BinaryResult

Wrapper around the run_executable() function. The first element of the command argument to the function will always be the path to the current binary.

class ngs_tools.binary.Binary.BinaryExecutor(binary: Binary, *args)

Class that handles execution of binaries with specified arguments.

pre_execute(command: str)
post_execute(command: str, result: BinaryResult)
__call__(values: Dict[str, Optional[str]], *args, **kwargs)

Run the binary with the specified values for each of the arguments.