diff --git a/exec_helpers/_ssh_client_base.pyi b/exec_helpers/_ssh_client_base.pyi index 6325d83..61ecce9 100644 --- a/exec_helpers/_ssh_client_base.pyi +++ b/exec_helpers/_ssh_client_base.pyi @@ -10,17 +10,22 @@ CPYTHON: bool = ... class _MemorizedSSH(type): @classmethod - def __prepare__(mcs: typing.Type[_MemorizedSSH], name: str, bases: typing.Iterable[typing.Type], **kwargs: typing.Dict) -> collections.OrderedDict: ... + def __prepare__( + mcs: typing.Type[_MemorizedSSH], + name: str, + bases: typing.Iterable[typing.Type], + **kwargs: typing.Dict + ) -> collections.OrderedDict: ... def __call__( # type: ignore cls: _MemorizedSSH, host: str, - port: int=..., - username: typing.Optional[str]=..., - password: typing.Optional[str]=..., - private_keys: typing.Optional[typing.Iterable[paramiko.RSAKey]]=..., - auth: typing.Optional[ssh_auth.SSHAuth]=..., - verbose: bool=... + port: int = ..., + username: typing.Optional[str] = ..., + password: typing.Optional[str] = ..., + private_keys: typing.Optional[typing.Iterable[paramiko.RSAKey]] = ..., + auth: typing.Optional[ssh_auth.SSHAuth] = ..., + verbose: bool = ..., ) -> SSHClientBase: ... @classmethod @@ -36,12 +41,12 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH): def __init__( self, host: str, - port: int=..., - username: typing.Optional[str]=..., - password: typing.Optional[str]=..., - private_keys: typing.Optional[typing.Iterable[paramiko.RSAKey]]=..., - auth: typing.Optional[ssh_auth.SSHAuth]=..., - verbose: bool=... + port: int = ..., + username: typing.Optional[str] = ..., + password: typing.Optional[str] = ..., + private_keys: typing.Optional[typing.Iterable[paramiko.RSAKey]] = ..., + auth: typing.Optional[ssh_auth.SSHAuth] = ..., + verbose: bool = ..., ) -> None: ... @property @@ -90,20 +95,25 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH): def reconnect(self) -> None: ... - def sudo(self, enforce: typing.Optional[bool]=...) -> typing.ContextManager: ... + def sudo(self, enforce: typing.Optional[bool] = ...) -> typing.ContextManager: ... - def keepalive(self, enforce: bool=...) -> typing.ContextManager: ... + def keepalive(self, enforce: bool = ...) -> typing.ContextManager: ... def execute_async( self, command: str, - stdin: typing.Union[typing.AnyStr, bytearray, None]=..., - open_stdout: bool=..., - open_stderr: bool=..., - verbose: bool=..., - log_mask_re: typing.Optional[str]=..., + stdin: typing.Union[typing.AnyStr, bytearray, None] = ..., + open_stdout: bool = ..., + open_stderr: bool = ..., + verbose: bool = ..., + log_mask_re: typing.Optional[str] = ..., **kwargs: typing.Dict - ) -> typing.Tuple[paramiko.Channel, paramiko.ChannelFile, typing.Optional[paramiko.ChannelFile], typing.Optional[paramiko.ChannelFile]]: ... + ) -> typing.Tuple[ + paramiko.Channel, + paramiko.ChannelFile, + typing.Optional[paramiko.ChannelFile], + typing.Optional[paramiko.ChannelFile], + ]: ... def _exec_command( self, @@ -112,8 +122,8 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH): stdout: paramiko.channel.ChannelFile, stderr: paramiko.channel.ChannelFile, timeout: typing.Union[int, None], - verbose: bool=..., - log_mask_re: typing.Optional[str]=..., + verbose: bool = ..., + log_mask_re: typing.Optional[str] = ..., **kwargs: typing.Dict ) -> exec_result.ExecResult: ... @@ -121,11 +131,11 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH): self, hostname: str, command: str, - auth: typing.Optional[ssh_auth.SSHAuth]=..., - target_port: int=..., - verbose: bool=..., - timeout: typing.Union[int, None]=..., - get_pty: bool=..., + auth: typing.Optional[ssh_auth.SSHAuth] = ..., + target_port: int = ..., + verbose: bool = ..., + timeout: typing.Union[int, None] = ..., + get_pty: bool = ..., **kwargs: typing.Dict ) -> exec_result.ExecResult: ... @@ -134,9 +144,9 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH): cls, remotes: typing.Iterable[SSHClientBase], command: str, - timeout: typing.Union[int, None]=..., - expected: typing.Optional[typing.Iterable[int]]=..., - raise_on_err: bool=..., + timeout: typing.Union[int, None] = ..., + expected: typing.Optional[typing.Iterable[int]] = ..., + raise_on_err: bool = ..., **kwargs: typing.Dict ) -> typing.Dict[typing.Tuple[str, int], exec_result.ExecResult]: ... @@ -146,7 +156,7 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH): def stat(self, path: str) -> paramiko.sftp_attr.SFTPAttributes: ... - def utime(self, path: str, times: typing.Optional[typing.Tuple[int, int]]=...) -> None: ... + def utime(self, path: str, times: typing.Optional[typing.Tuple[int, int]] = ...) -> None: ... def isfile(self, path: str) -> bool: ... diff --git a/exec_helpers/api.pyi b/exec_helpers/api.pyi index 90660f3..ccbcec1 100644 --- a/exec_helpers/api.pyi +++ b/exec_helpers/api.pyi @@ -7,7 +7,7 @@ from exec_helpers import exec_result, proc_enums class ExecHelper: log_mask_re: typing.Optional[str] = ... - def __init__(self, logger: logging.Logger, log_mask_re: typing.Optional[str]=...) -> None: ... + def __init__(self, logger: logging.Logger, log_mask_re: typing.Optional[str] = ...) -> None: ... @property def logger(self) -> logging.Logger: ... @@ -19,18 +19,18 @@ class ExecHelper: def __exit__(self, exc_type: typing.Any, exc_val: typing.Any, exc_tb: typing.Any) -> None: ... - def _mask_command(self, cmd: str, log_mask_re: typing.Optional[str]=...) -> str: ... + def _mask_command(self, cmd: str, log_mask_re: typing.Optional[str] = ...) -> str: ... def execute_async( self, command: str, - stdin: typing.Union[typing.AnyStr, bytearray, None]=..., - open_stdout: bool=..., - open_stderr: bool=..., - verbose: bool=..., - log_mask_re: typing.Optional[str]=..., + stdin: typing.Union[typing.AnyStr, bytearray, None] = ..., + open_stdout: bool = ..., + open_stderr: bool = ..., + verbose: bool = ..., + log_mask_re: typing.Optional[str] = ..., **kwargs: typing.Dict - ) -> typing.Tuple[typing.Any, typing.Any, typing.Any, typing.Any,]: ... + ) -> typing.Tuple[typing.Any, typing.Any, typing.Any, typing.Any]: ... def _exec_command( self, @@ -39,36 +39,36 @@ class ExecHelper: stdout: typing.Any, stderr: typing.Any, timeout: typing.Union[int, None], - verbose: bool=..., - log_mask_re: typing.Optional[str]=..., + verbose: bool = ..., + log_mask_re: typing.Optional[str] = ..., **kwargs: typing.Dict ) -> exec_result.ExecResult: ... def execute( self, command: str, - verbose: bool=..., - timeout: typing.Union[int, None]=..., + verbose: bool = ..., + timeout: typing.Union[int, None] = ..., **kwargs: typing.Type ) -> exec_result.ExecResult: ... def check_call( self, command: str, - verbose: bool=..., - timeout: typing.Union[int, None]=..., - error_info: typing.Optional[str]=..., - expected: typing.Optional[typing.Iterable[typing.Union[int, proc_enums.ExitCodes]]]=..., - raise_on_err: bool=..., + verbose: bool = ..., + timeout: typing.Union[int, None] = ..., + error_info: typing.Optional[str] = ..., + expected: typing.Optional[typing.Iterable[typing.Union[int, proc_enums.ExitCodes]]] = ..., + raise_on_err: bool = ..., **kwargs: typing.Type ) -> exec_result.ExecResult: ... def check_stderr( self, command: str, - verbose: bool=..., - timeout: typing.Union[int, None]=..., - error_info: typing.Optional[str]=..., - raise_on_err: bool=..., + verbose: bool = ..., + timeout: typing.Union[int, None] = ..., + error_info: typing.Optional[str] = ..., + raise_on_err: bool = ..., **kwargs: typing.Dict ) -> exec_result.ExecResult: ... diff --git a/exec_helpers/exceptions.pyi b/exec_helpers/exceptions.pyi index 1f4558b..3df60f5 100644 --- a/exec_helpers/exceptions.pyi +++ b/exec_helpers/exceptions.pyi @@ -1,27 +1,18 @@ import typing from exec_helpers import proc_enums, exec_result -class ExecHelperError(Exception): - ... +class ExecHelperError(Exception): ... -class DeserializeValueError(ExecHelperError, ValueError): - ... - - -class ExecCalledProcessError(ExecHelperError): - ... +class DeserializeValueError(ExecHelperError, ValueError): ... +class ExecCalledProcessError(ExecHelperError): ... class ExecHelperTimeoutError(ExecCalledProcessError): result: exec_result.ExecResult = ... timeout: int = ... - def __init__( - self, - result: exec_result.ExecResult, - timeout: typing.Union[int, float], - ) -> None: ... + def __init__(self, result: exec_result.ExecResult, timeout: typing.Union[int, float]) -> None: ... @property def cmd(self) -> str: ... @@ -36,13 +27,12 @@ class ExecHelperTimeoutError(ExecCalledProcessError): class CalledProcessError(ExecCalledProcessError): result: exec_result.ExecResult = ... - expected: typing.List[typing.Union[int, proc_enums.ExitCodes]] = ... def __init__( self, result: exec_result.ExecResult, - expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]]=... + expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]] = ..., ) -> None: ... @property @@ -72,7 +62,7 @@ class ParallelCallExceptions(ExecCalledProcessError): exceptions: typing.Dict[typing.Tuple[str, int], Exception], errors: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult], results: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult], - expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]]=... + expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]] = ..., ) -> None: ... class ParallelCallProcessError(ExecCalledProcessError): @@ -87,5 +77,5 @@ class ParallelCallProcessError(ExecCalledProcessError): command: str, errors: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult], results: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult], - expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]]=... + expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]] = ..., ) -> None: ... diff --git a/exec_helpers/exec_result.pyi b/exec_helpers/exec_result.pyi index 9780772..88b515c 100644 --- a/exec_helpers/exec_result.pyi +++ b/exec_helpers/exec_result.pyi @@ -8,10 +8,10 @@ class ExecResult: def __init__( self, cmd: str, - stdin: typing.Union[typing.AnyStr, bytearray, None]=..., - stdout: typing.Optional[typing.Iterable[bytes]]=..., - stderr: typing.Optional[typing.Iterable[bytes]]=..., - exit_code: typing.Union[int, proc_enums.ExitCodes]=... + stdin: typing.Union[typing.AnyStr, bytearray, None] = ..., + stdout: typing.Optional[typing.Iterable[bytes]] = ..., + stderr: typing.Optional[typing.Iterable[bytes]] = ..., + exit_code: typing.Union[int, proc_enums.ExitCodes] = ..., ) -> None: ... @property @@ -43,16 +43,16 @@ class ExecResult: def read_stdout( self, - src: typing.Optional[typing.Iterable]=..., - log: typing.Optional[logging.Logger]=..., - verbose: bool=... + src: typing.Optional[typing.Iterable] = ..., + log: typing.Optional[logging.Logger] = ..., + verbose: bool = ..., ) -> None: ... def read_stderr( self, - src: typing.Optional[typing.Iterable]=..., - log: typing.Optional[logging.Logger]=..., - verbose: bool=... + src: typing.Optional[typing.Iterable] = ..., + log: typing.Optional[logging.Logger] = ..., + verbose: bool = ..., ) -> None: ... @property diff --git a/exec_helpers/ssh_auth.pyi b/exec_helpers/ssh_auth.pyi index 9711e0b..f0d0ad4 100644 --- a/exec_helpers/ssh_auth.pyi +++ b/exec_helpers/ssh_auth.pyi @@ -5,12 +5,12 @@ import typing class SSHAuth: def __init__( self, - username: typing.Optional[str]=..., - password: typing.Optional[str]=..., - key: typing.Optional[paramiko.RSAKey]=..., - keys: typing.Optional[typing.Iterable[paramiko.RSAKey]]=..., - key_filename: typing.Union[typing.List[str], str, None]=..., - passphrase: typing.Optional[str]=... + username: typing.Optional[str] = ..., + password: typing.Optional[str] = ..., + key: typing.Optional[paramiko.RSAKey] = ..., + keys: typing.Optional[typing.Iterable[paramiko.RSAKey]] = ..., + key_filename: typing.Union[typing.List[str], str, None] = ..., + passphrase: typing.Optional[str] = ..., ) -> None: ... @property @@ -27,9 +27,9 @@ class SSHAuth: def connect( self, client: typing.Union[paramiko.SSHClient, paramiko.Transport], - hostname: typing.Optional[str]=..., - port: int=..., - log: bool=... + hostname: typing.Optional[str] = ..., + port: int = ..., + log: bool = ..., ) -> None: ... def __eq__(self, other: typing.Any) -> bool: ... diff --git a/exec_helpers/subprocess_runner.pyi b/exec_helpers/subprocess_runner.pyi index 016ebc7..ca9f7fa 100644 --- a/exec_helpers/subprocess_runner.pyi +++ b/exec_helpers/subprocess_runner.pyi @@ -19,17 +19,19 @@ class SingletonMeta(type): def __call__(cls: SingletonMeta, *args: typing.Tuple, **kwargs: typing.Dict) -> typing.Any: ... @classmethod - def __prepare__(mcs: typing.Type[SingletonMeta], name: str, bases: typing.Iterable[typing.Type], **kwargs: typing.Dict) -> collections.OrderedDict: ... + def __prepare__( + mcs: typing.Type[SingletonMeta], + name: str, + bases: typing.Iterable[typing.Type], + **kwargs: typing.Dict + ) -> collections.OrderedDict: ... def set_nonblocking_pipe(pipe: typing.Any) -> None: ... class Subprocess(api.ExecHelper, metaclass=SingletonMeta): - def __init__( - self, - log_mask_re: typing.Optional[str]=... - ) -> None: ... + def __init__(self, log_mask_re: typing.Optional[str] = ...) -> None: ... def _exec_command( self, @@ -38,8 +40,8 @@ class Subprocess(api.ExecHelper, metaclass=SingletonMeta): stdout: typing.Optional[typing.IO], stderr: typing.Optional[typing.IO], timeout: typing.Union[int, None], - verbose: bool=..., - log_mask_re: typing.Optional[str]=..., + verbose: bool = ..., + log_mask_re: typing.Optional[str] = ..., **kwargs: typing.Dict ) -> exec_result.ExecResult: ... @@ -47,11 +49,11 @@ class Subprocess(api.ExecHelper, metaclass=SingletonMeta): def execute_async( self, command: str, - stdin: typing.Union[typing.AnyStr, bytearray]=..., - open_stdout: bool=..., - open_stderr: bool=..., - verbose: bool=..., - log_mask_re: typing.Optional[str]=..., + stdin: typing.Union[typing.AnyStr, bytearray] = ..., + open_stdout: bool = ..., + open_stderr: bool = ..., + verbose: bool = ..., + log_mask_re: typing.Optional[str] = ..., **kwargs: typing.Dict ) -> typing.Tuple[subprocess.Popen, None, None, None]: ... @@ -59,10 +61,10 @@ class Subprocess(api.ExecHelper, metaclass=SingletonMeta): def execute_async( self, command: str, - stdin: None=..., - open_stdout: bool=..., - open_stderr: bool=..., - verbose: bool=..., - log_mask_re: typing.Optional[str]=..., + stdin: None = ..., + open_stdout: bool = ..., + open_stderr: bool = ..., + verbose: bool = ..., + log_mask_re: typing.Optional[str] = ..., **kwargs: typing.Dict ) -> typing.Tuple[subprocess.Popen, None, typing.IO, typing.IO]: ...