Skip to content

Commit 93fd63a

Browse files
authored
Old is for py27 only. Backport typehints from validated new version (#72)
* Old is for py27 only. Backport typehints from validated new version * no *.pyi * no cythonize support code * static analisys from python 3.6 without sdist (because of mypy) * Remove tests, which are expected no python 2.7 compatible
1 parent ec471cf commit 93fd63a

24 files changed

+215
-1038
lines changed

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: python
33
os: linux
44
python:
55
- &main_python 2.7
6-
- 3.4
76
- &pypy pypy
87
install:
98
- &upgrade_python_toolset pip install --upgrade pip setuptools wheel
@@ -17,7 +16,7 @@ jobs:
1716
fast_finish: true
1817
include:
1918
- stage: Static analisys
20-
python: 3.4
19+
python: 3.6
2120
services: []
2221
install:
2322
- *upgrade_python_toolset
@@ -27,7 +26,7 @@ jobs:
2726
after_success: skip
2827

2928
- stage: Code style check
30-
python: 3.4
29+
python: *main_python
3130
install:
3231
- *upgrade_python_toolset
3332
- pip install tox
@@ -43,8 +42,7 @@ jobs:
4342
services: []
4443
install:
4544
- *upgrade_python_toolset
46-
script:
47-
- ./tools/run_docker.sh "exec_helpers"
45+
script: []
4846
before_deploy:
4947
- pip install -r build_requirements.txt
5048
- python setup.py bdist_wheel

README.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ Pros:
4343
::
4444

4545
Python 2.7
46-
Python 3.4
4746
PyPy
4847

49-
.. note:: Update to version 2.0+ for usage with python 3.5+. This version is for legacy python and no new features are planned.
48+
.. note:: Update to version 2.0+ for usage with python 3.4+. This version is for legacy python and no new features are planned.
5049

5150
This package includes:
5251

@@ -127,7 +126,7 @@ This methods are almost the same for `SSHCleint` and `Subprocess`, except specif
127126
result = helper.execute(
128127
command, # type: str
129128
verbose=False, # type: bool
130-
timeout=1 * 60 * 60, # type: typing.Optional[int]
129+
timeout=1 * 60 * 60, # type: typing.Union[int, float, None]
131130
**kwargs
132131
)
133132
@@ -137,7 +136,7 @@ This methods are almost the same for `SSHCleint` and `Subprocess`, except specif
137136
result = helper.check_call(
138137
command, # type: str
139138
verbose=False, # type: bool
140-
timeout=1 * 60 * 60, # type: typing.Optional[int]
139+
timeout=1 * 60 * 60, # type: type: typing.Union[int, float, None]
141140
error_info=None, # type: typing.Optional[str]
142141
expected=None, # type: typing.Optional[typing.Iterable[int]]
143142
raise_on_err=True, # type: bool
@@ -149,7 +148,7 @@ This methods are almost the same for `SSHCleint` and `Subprocess`, except specif
149148
result = helper.check_stderr(
150149
command, # type: str
151150
verbose=False, # type: bool
152-
timeout=1 * 60 * 60, # type: typing.Optional[int]
151+
timeout=1 * 60 * 60, # type: type: typing.Union[int, float, None]
153152
error_info=None, # type: typing.Optional[str]
154153
raise_on_err=True, # type: bool
155154
)
@@ -185,10 +184,10 @@ Execution result object has a set of useful properties:
185184
* `stderr` -> `typing.Tuple[bytes]`. Raw stderr output.
186185
* `stdout_bin` -> `bytearray`. Binary stdout output.
187186
* `stderr_bin` -> `bytearray`. Binary stderr output.
188-
* `stdout_str` -> `six.text_types`. Text representation of output.
189-
* `stderr_str` -> `six.text_types`. Text representation of output.
190-
* `stdout_brief` -> `six.text_types`. Up to 7 lines from stdout (3 first and 3 last if >7 lines).
191-
* `stderr_brief` -> `six.text_types`. Up to 7 lines from stderr (3 first and 3 last if >7 lines).
187+
* `stdout_str` -> `typing.Text`. Text representation of output.
188+
* `stderr_str` -> `typing.Text`. Text representation of output.
189+
* `stdout_brief` -> `typing.Text`. Up to 7 lines from stdout (3 first and 3 last if >7 lines).
190+
* `stderr_brief` -> `typing.Text`. Up to 7 lines from stderr (3 first and 3 last if >7 lines).
192191

193192
* `stdout_json` - STDOUT decoded as JSON.
194193

@@ -209,7 +208,7 @@ Possible to call commands in parallel on multiple hosts if it's not produce huge
209208
results = SSHClient.execute_together(
210209
remotes, # type: typing.Iterable[SSHClient]
211210
command, # type: str
212-
timeout=1 * 60 * 60, # type: typing.Optional[int]
211+
timeout=1 * 60 * 60, # type: type: typing.Union[int, float, None]
213212
expected=None, # type: typing.Optional[typing.Iterable[int]]
214213
raise_on_err=True # type: bool
215214
)
@@ -227,7 +226,7 @@ For execute through SSH host can be used `execute_through_host` method:
227226
command, # type: str
228227
auth=None, # type: typing.Optional[SSHAuth]
229228
target_port=22, # type: int
230-
timeout=1 * 60 * 60, # type: typing.Optional[int]
229+
timeout=1 * 60 * 60, # type: type: typing.Union[int, float, None]
231230
verbose=False, # type: bool
232231
get_pty=False, # type: bool
233232
)

doc/source/ExecResult.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ API: ExecResult
1515
:param cmd: command
1616
:type cmd: ``str``
1717
:param stdin: STDIN
18-
:type stdin: ``typing.Optional[str]``
18+
:type stdin: ``typing.Union[bytes, str, bytearray, None]``
1919
:param stdout: binary STDOUT
2020
:type stdout: ``typing.Optional[typing.Iterable[bytes]]``
2121
:param stderr: binary STDERR
@@ -40,17 +40,17 @@ API: ExecResult
4040

4141
.. py:attribute:: stdin
4242
43-
``typing.Text``
43+
``typing.Optional[str]``
4444
Stdin input as string.
4545

4646
.. py:attribute:: stdout
4747
48-
``typing.Tuple[bytes]``
48+
``typing.Tuple[bytes, ...]``
4949
Stdout output as list of binaries.
5050

5151
.. py:attribute:: stderr
5252
53-
``typing.Tuple[bytes]``
53+
``typing.Tuple[bytes, ...]``
5454
Stderr output as list of binaries.
5555

5656
.. py:attribute:: stdout_bin

doc/source/SSHClient.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ API: SSHClient and SSHAuth.
128128
:param command: Command for execution
129129
:type command: ``str``
130130
:param stdin: pass STDIN text to the process
131-
:type stdin: ``typing.Union[typing.AnyStr, bytearray, None]``
131+
:type stdin: ``typing.Union[str, bytes, bytearray, None]``
132132
:param open_stdout: open STDOUT stream for read
133133
:type open_stdout: bool
134134
:param open_stderr: open STDERR stream for read
@@ -153,7 +153,7 @@ API: SSHClient and SSHAuth.
153153
:param verbose: Produce log.info records for command call and output
154154
:type verbose: ``bool``
155155
:param timeout: Timeout for command execution.
156-
:type timeout: ``typing.Union[int, None]``
156+
:type timeout: ``typing.Union[int, float, None]``
157157
:rtype: ExecResult
158158
:raises ExecHelperTimeoutError: Timeout exceeded
159159

@@ -168,7 +168,7 @@ API: SSHClient and SSHAuth.
168168
:param verbose: Produce log.info records for command call and output
169169
:type verbose: ``bool``
170170
:param timeout: Timeout for command execution.
171-
:type timeout: ``typing.Union[int, None]``
171+
:type timeout: ``typing.Union[int, float, None]``
172172
:param error_info: Text for error details, if fail happens
173173
:type error_info: ``typing.Optional[str]``
174174
:param expected: expected return codes (0 by default)
@@ -190,7 +190,7 @@ API: SSHClient and SSHAuth.
190190
:param verbose: Produce log.info records for command call and output
191191
:type verbose: ``bool``
192192
:param timeout: Timeout for command execution.
193-
:type timeout: ``typing.Union[int, None]``
193+
:type timeout: ``typing.Union[int, float, None]``
194194
:param error_info: Text for error details, if fail happens
195195
:type error_info: ``typing.Optional[str]``
196196
:param raise_on_err: Raise exception on unexpected return code
@@ -217,7 +217,7 @@ API: SSHClient and SSHAuth.
217217
:param verbose: Produce log.info records for command call and output
218218
:type verbose: ``bool``
219219
:param timeout: Timeout for command execution.
220-
:type timeout: ``typing.Union[int, None]``
220+
:type timeout: ``typing.Union[int, float, None]``
221221
:param get_pty: open PTY on target machine
222222
:type get_pty: ``bool``
223223
:rtype: ExecResult
@@ -234,7 +234,7 @@ API: SSHClient and SSHAuth.
234234
:param command: Command for execution
235235
:type command: ``str``
236236
:param timeout: Timeout for command execution.
237-
:type timeout: ``typing.Union[int, None]``
237+
:type timeout: ``typing.Union[int, float, None]``
238238
:param expected: expected return codes (0 by default)
239239
:type expected: ``typing.Optional[typing.Iterable[]]``
240240
:param raise_on_err: Raise exception on unexpected return code

doc/source/Subprocess.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ API: Subprocess
4646
:param command: Command for execution
4747
:type command: str
4848
:param stdin: pass STDIN text to the process
49-
:type stdin: ``typing.Union[typing.AnyStr, bytearray, None]``
49+
:type stdin: ``typing.Union[str, bytes, bytearray, None]``
5050
:param open_stdout: open STDOUT stream for read
5151
:type open_stdout: ``bool``
5252
:param open_stderr: open STDERR stream for read
@@ -69,7 +69,7 @@ API: Subprocess
6969
:param verbose: Produce log.info records for command call and output
7070
:type verbose: ``bool``
7171
:param timeout: Timeout for command execution.
72-
:type timeout: ``typing.Union[int, None]``
72+
:type timeout: ``typing.Union[int, float, None]``
7373
:rtype: ExecResult
7474
:raises ExecHelperTimeoutError: Timeout exceeded
7575

@@ -88,7 +88,7 @@ API: Subprocess
8888
:param verbose: Produce log.info records for command call and output
8989
:type verbose: ``bool``
9090
:param timeout: Timeout for command execution.
91-
:type timeout: ``typing.Union[int, None]``
91+
:type timeout: ``typing.Union[int, float, None]``
9292
:param error_info: Text for error details, if fail happens
9393
:type error_info: ``typing.Optional[str]``
9494
:param expected: expected return codes (0 by default)
@@ -111,7 +111,7 @@ API: Subprocess
111111
:param verbose: Produce log.info records for command call and output
112112
:type verbose: ``bool``
113113
:param timeout: Timeout for command execution.
114-
:type timeout: ``typing.Union[int, None]``
114+
:type timeout: ``typing.Union[int, float, None]``
115115
:param error_info: Text for error details, if fail happens
116116
:type error_info: ``typing.Optional[str]``
117117
:param raise_on_err: Raise exception on unexpected return code

doc/source/exceptions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ API: exceptions
3636

3737
.. py:attribute:: timeout
3838
39-
``int``
39+
``typing.Union[int, float]``
4040

4141
.. py:attribute:: result
4242

0 commit comments

Comments
 (0)