Skip to content

Commit 804e10f

Browse files
authored
Partial reformat stubs with black (#57)
1 parent 0449c39 commit 804e10f

File tree

6 files changed

+108
-106
lines changed

6 files changed

+108
-106
lines changed

exec_helpers/_ssh_client_base.pyi

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@ CPYTHON: bool = ...
1010

1111
class _MemorizedSSH(type):
1212
@classmethod
13-
def __prepare__(mcs: typing.Type[_MemorizedSSH], name: str, bases: typing.Iterable[typing.Type], **kwargs: typing.Dict) -> collections.OrderedDict: ...
13+
def __prepare__(
14+
mcs: typing.Type[_MemorizedSSH],
15+
name: str,
16+
bases: typing.Iterable[typing.Type],
17+
**kwargs: typing.Dict
18+
) -> collections.OrderedDict: ...
1419

1520
def __call__( # type: ignore
1621
cls: _MemorizedSSH,
1722
host: str,
18-
port: int=...,
19-
username: typing.Optional[str]=...,
20-
password: typing.Optional[str]=...,
21-
private_keys: typing.Optional[typing.Iterable[paramiko.RSAKey]]=...,
22-
auth: typing.Optional[ssh_auth.SSHAuth]=...,
23-
verbose: bool=...
23+
port: int = ...,
24+
username: typing.Optional[str] = ...,
25+
password: typing.Optional[str] = ...,
26+
private_keys: typing.Optional[typing.Iterable[paramiko.RSAKey]] = ...,
27+
auth: typing.Optional[ssh_auth.SSHAuth] = ...,
28+
verbose: bool = ...,
2429
) -> SSHClientBase: ...
2530

2631
@classmethod
@@ -36,12 +41,12 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH):
3641
def __init__(
3742
self,
3843
host: str,
39-
port: int=...,
40-
username: typing.Optional[str]=...,
41-
password: typing.Optional[str]=...,
42-
private_keys: typing.Optional[typing.Iterable[paramiko.RSAKey]]=...,
43-
auth: typing.Optional[ssh_auth.SSHAuth]=...,
44-
verbose: bool=...
44+
port: int = ...,
45+
username: typing.Optional[str] = ...,
46+
password: typing.Optional[str] = ...,
47+
private_keys: typing.Optional[typing.Iterable[paramiko.RSAKey]] = ...,
48+
auth: typing.Optional[ssh_auth.SSHAuth] = ...,
49+
verbose: bool = ...,
4550
) -> None: ...
4651

4752
@property
@@ -90,20 +95,25 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH):
9095

9196
def reconnect(self) -> None: ...
9297

93-
def sudo(self, enforce: typing.Optional[bool]=...) -> typing.ContextManager: ...
98+
def sudo(self, enforce: typing.Optional[bool] = ...) -> typing.ContextManager: ...
9499

95-
def keepalive(self, enforce: bool=...) -> typing.ContextManager: ...
100+
def keepalive(self, enforce: bool = ...) -> typing.ContextManager: ...
96101

97102
def execute_async(
98103
self,
99104
command: str,
100-
stdin: typing.Union[typing.AnyStr, bytearray, None]=...,
101-
open_stdout: bool=...,
102-
open_stderr: bool=...,
103-
verbose: bool=...,
104-
log_mask_re: typing.Optional[str]=...,
105+
stdin: typing.Union[typing.AnyStr, bytearray, None] = ...,
106+
open_stdout: bool = ...,
107+
open_stderr: bool = ...,
108+
verbose: bool = ...,
109+
log_mask_re: typing.Optional[str] = ...,
105110
**kwargs: typing.Dict
106-
) -> typing.Tuple[paramiko.Channel, paramiko.ChannelFile, typing.Optional[paramiko.ChannelFile], typing.Optional[paramiko.ChannelFile]]: ...
111+
) -> typing.Tuple[
112+
paramiko.Channel,
113+
paramiko.ChannelFile,
114+
typing.Optional[paramiko.ChannelFile],
115+
typing.Optional[paramiko.ChannelFile],
116+
]: ...
107117

108118
def _exec_command(
109119
self,
@@ -112,20 +122,20 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH):
112122
stdout: paramiko.channel.ChannelFile,
113123
stderr: paramiko.channel.ChannelFile,
114124
timeout: typing.Union[int, None],
115-
verbose: bool=...,
116-
log_mask_re: typing.Optional[str]=...,
125+
verbose: bool = ...,
126+
log_mask_re: typing.Optional[str] = ...,
117127
**kwargs: typing.Dict
118128
) -> exec_result.ExecResult: ...
119129

120130
def execute_through_host(
121131
self,
122132
hostname: str,
123133
command: str,
124-
auth: typing.Optional[ssh_auth.SSHAuth]=...,
125-
target_port: int=...,
126-
verbose: bool=...,
127-
timeout: typing.Union[int, None]=...,
128-
get_pty: bool=...,
134+
auth: typing.Optional[ssh_auth.SSHAuth] = ...,
135+
target_port: int = ...,
136+
verbose: bool = ...,
137+
timeout: typing.Union[int, None] = ...,
138+
get_pty: bool = ...,
129139
**kwargs: typing.Dict
130140
) -> exec_result.ExecResult: ...
131141

@@ -134,9 +144,9 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH):
134144
cls,
135145
remotes: typing.Iterable[SSHClientBase],
136146
command: str,
137-
timeout: typing.Union[int, None]=...,
138-
expected: typing.Optional[typing.Iterable[int]]=...,
139-
raise_on_err: bool=...,
147+
timeout: typing.Union[int, None] = ...,
148+
expected: typing.Optional[typing.Iterable[int]] = ...,
149+
raise_on_err: bool = ...,
140150
**kwargs: typing.Dict
141151
) -> typing.Dict[typing.Tuple[str, int], exec_result.ExecResult]: ...
142152

@@ -146,7 +156,7 @@ class SSHClientBase(api.ExecHelper, metaclass=_MemorizedSSH):
146156

147157
def stat(self, path: str) -> paramiko.sftp_attr.SFTPAttributes: ...
148158

149-
def utime(self, path: str, times: typing.Optional[typing.Tuple[int, int]]=...) -> None: ...
159+
def utime(self, path: str, times: typing.Optional[typing.Tuple[int, int]] = ...) -> None: ...
150160

151161
def isfile(self, path: str) -> bool: ...
152162

exec_helpers/api.pyi

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from exec_helpers import exec_result, proc_enums
77
class ExecHelper:
88
log_mask_re: typing.Optional[str] = ...
99

10-
def __init__(self, logger: logging.Logger, log_mask_re: typing.Optional[str]=...) -> None: ...
10+
def __init__(self, logger: logging.Logger, log_mask_re: typing.Optional[str] = ...) -> None: ...
1111

1212
@property
1313
def logger(self) -> logging.Logger: ...
@@ -19,18 +19,18 @@ class ExecHelper:
1919

2020
def __exit__(self, exc_type: typing.Any, exc_val: typing.Any, exc_tb: typing.Any) -> None: ...
2121

22-
def _mask_command(self, cmd: str, log_mask_re: typing.Optional[str]=...) -> str: ...
22+
def _mask_command(self, cmd: str, log_mask_re: typing.Optional[str] = ...) -> str: ...
2323

2424
def execute_async(
2525
self,
2626
command: str,
27-
stdin: typing.Union[typing.AnyStr, bytearray, None]=...,
28-
open_stdout: bool=...,
29-
open_stderr: bool=...,
30-
verbose: bool=...,
31-
log_mask_re: typing.Optional[str]=...,
27+
stdin: typing.Union[typing.AnyStr, bytearray, None] = ...,
28+
open_stdout: bool = ...,
29+
open_stderr: bool = ...,
30+
verbose: bool = ...,
31+
log_mask_re: typing.Optional[str] = ...,
3232
**kwargs: typing.Dict
33-
) -> typing.Tuple[typing.Any, typing.Any, typing.Any, typing.Any,]: ...
33+
) -> typing.Tuple[typing.Any, typing.Any, typing.Any, typing.Any]: ...
3434

3535
def _exec_command(
3636
self,
@@ -39,36 +39,36 @@ class ExecHelper:
3939
stdout: typing.Any,
4040
stderr: typing.Any,
4141
timeout: typing.Union[int, None],
42-
verbose: bool=...,
43-
log_mask_re: typing.Optional[str]=...,
42+
verbose: bool = ...,
43+
log_mask_re: typing.Optional[str] = ...,
4444
**kwargs: typing.Dict
4545
) -> exec_result.ExecResult: ...
4646

4747
def execute(
4848
self,
4949
command: str,
50-
verbose: bool=...,
51-
timeout: typing.Union[int, None]=...,
50+
verbose: bool = ...,
51+
timeout: typing.Union[int, None] = ...,
5252
**kwargs: typing.Type
5353
) -> exec_result.ExecResult: ...
5454

5555
def check_call(
5656
self,
5757
command: str,
58-
verbose: bool=...,
59-
timeout: typing.Union[int, None]=...,
60-
error_info: typing.Optional[str]=...,
61-
expected: typing.Optional[typing.Iterable[typing.Union[int, proc_enums.ExitCodes]]]=...,
62-
raise_on_err: bool=...,
58+
verbose: bool = ...,
59+
timeout: typing.Union[int, None] = ...,
60+
error_info: typing.Optional[str] = ...,
61+
expected: typing.Optional[typing.Iterable[typing.Union[int, proc_enums.ExitCodes]]] = ...,
62+
raise_on_err: bool = ...,
6363
**kwargs: typing.Type
6464
) -> exec_result.ExecResult: ...
6565

6666
def check_stderr(
6767
self,
6868
command: str,
69-
verbose: bool=...,
70-
timeout: typing.Union[int, None]=...,
71-
error_info: typing.Optional[str]=...,
72-
raise_on_err: bool=...,
69+
verbose: bool = ...,
70+
timeout: typing.Union[int, None] = ...,
71+
error_info: typing.Optional[str] = ...,
72+
raise_on_err: bool = ...,
7373
**kwargs: typing.Dict
7474
) -> exec_result.ExecResult: ...

exec_helpers/exceptions.pyi

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
import typing
22
from exec_helpers import proc_enums, exec_result
33

4-
class ExecHelperError(Exception):
5-
...
4+
class ExecHelperError(Exception): ...
65

7-
class DeserializeValueError(ExecHelperError, ValueError):
8-
...
9-
10-
11-
class ExecCalledProcessError(ExecHelperError):
12-
...
6+
class DeserializeValueError(ExecHelperError, ValueError): ...
137

8+
class ExecCalledProcessError(ExecHelperError): ...
149

1510
class ExecHelperTimeoutError(ExecCalledProcessError):
1611

1712
result: exec_result.ExecResult = ...
1813
timeout: int = ...
1914

20-
def __init__(
21-
self,
22-
result: exec_result.ExecResult,
23-
timeout: typing.Union[int, float],
24-
) -> None: ...
15+
def __init__(self, result: exec_result.ExecResult, timeout: typing.Union[int, float]) -> None: ...
2516

2617
@property
2718
def cmd(self) -> str: ...
@@ -36,13 +27,12 @@ class ExecHelperTimeoutError(ExecCalledProcessError):
3627
class CalledProcessError(ExecCalledProcessError):
3728

3829
result: exec_result.ExecResult = ...
39-
4030
expected: typing.List[typing.Union[int, proc_enums.ExitCodes]] = ...
4131

4232
def __init__(
4333
self,
4434
result: exec_result.ExecResult,
45-
expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]]=...
35+
expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]] = ...,
4636
) -> None: ...
4737

4838
@property
@@ -72,7 +62,7 @@ class ParallelCallExceptions(ExecCalledProcessError):
7262
exceptions: typing.Dict[typing.Tuple[str, int], Exception],
7363
errors: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult],
7464
results: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult],
75-
expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]]=...
65+
expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]] = ...,
7666
) -> None: ...
7767

7868
class ParallelCallProcessError(ExecCalledProcessError):
@@ -87,5 +77,5 @@ class ParallelCallProcessError(ExecCalledProcessError):
8777
command: str,
8878
errors: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult],
8979
results: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult],
90-
expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]]=...
80+
expected: typing.Optional[typing.List[typing.Union[int, proc_enums.ExitCodes]]] = ...,
9181
) -> None: ...

exec_helpers/exec_result.pyi

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ class ExecResult:
88
def __init__(
99
self,
1010
cmd: str,
11-
stdin: typing.Union[typing.AnyStr, bytearray, None]=...,
12-
stdout: typing.Optional[typing.Iterable[bytes]]=...,
13-
stderr: typing.Optional[typing.Iterable[bytes]]=...,
14-
exit_code: typing.Union[int, proc_enums.ExitCodes]=...
11+
stdin: typing.Union[typing.AnyStr, bytearray, None] = ...,
12+
stdout: typing.Optional[typing.Iterable[bytes]] = ...,
13+
stderr: typing.Optional[typing.Iterable[bytes]] = ...,
14+
exit_code: typing.Union[int, proc_enums.ExitCodes] = ...,
1515
) -> None: ...
1616

1717
@property
@@ -43,16 +43,16 @@ class ExecResult:
4343

4444
def read_stdout(
4545
self,
46-
src: typing.Optional[typing.Iterable]=...,
47-
log: typing.Optional[logging.Logger]=...,
48-
verbose: bool=...
46+
src: typing.Optional[typing.Iterable] = ...,
47+
log: typing.Optional[logging.Logger] = ...,
48+
verbose: bool = ...,
4949
) -> None: ...
5050

5151
def read_stderr(
5252
self,
53-
src: typing.Optional[typing.Iterable]=...,
54-
log: typing.Optional[logging.Logger]=...,
55-
verbose: bool=...
53+
src: typing.Optional[typing.Iterable] = ...,
54+
log: typing.Optional[logging.Logger] = ...,
55+
verbose: bool = ...,
5656
) -> None: ...
5757

5858
@property

exec_helpers/ssh_auth.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import typing
55
class SSHAuth:
66
def __init__(
77
self,
8-
username: typing.Optional[str]=...,
9-
password: typing.Optional[str]=...,
10-
key: typing.Optional[paramiko.RSAKey]=...,
11-
keys: typing.Optional[typing.Iterable[paramiko.RSAKey]]=...,
12-
key_filename: typing.Union[typing.List[str], str, None]=...,
13-
passphrase: typing.Optional[str]=...
8+
username: typing.Optional[str] = ...,
9+
password: typing.Optional[str] = ...,
10+
key: typing.Optional[paramiko.RSAKey] = ...,
11+
keys: typing.Optional[typing.Iterable[paramiko.RSAKey]] = ...,
12+
key_filename: typing.Union[typing.List[str], str, None] = ...,
13+
passphrase: typing.Optional[str] = ...,
1414
) -> None: ...
1515

1616
@property
@@ -27,9 +27,9 @@ class SSHAuth:
2727
def connect(
2828
self,
2929
client: typing.Union[paramiko.SSHClient, paramiko.Transport],
30-
hostname: typing.Optional[str]=...,
31-
port: int=...,
32-
log: bool=...
30+
hostname: typing.Optional[str] = ...,
31+
port: int = ...,
32+
log: bool = ...,
3333
) -> None: ...
3434

3535
def __eq__(self, other: typing.Any) -> bool: ...

0 commit comments

Comments
 (0)