6565_type_execute_async = typing .Tuple [
6666 paramiko .Channel ,
6767 paramiko .ChannelFile ,
68- paramiko .ChannelFile ,
69- paramiko .ChannelFile
68+ typing . Optional [ paramiko .ChannelFile ] ,
69+ typing . Optional [ paramiko .ChannelFile ]
7070]
7171
7272CPYTHON = 'CPython' == platform .python_implementation ()
@@ -101,7 +101,7 @@ class _MemorizedSSH(type):
101101 duplicates is possible.
102102 """
103103
104- __cache = {}
104+ __cache = {} # type: typing.Dict[typing.Tuple[str, int], SSHClientBase]
105105
106106 @classmethod
107107 def __prepare__ (
@@ -622,7 +622,7 @@ def poll_pipes(
622622 :type stop: Event
623623 :type channel: paramiko.channel.Channel
624624 """
625- while not stop .isSet ():
625+ while not stop .is_set ():
626626 time .sleep (0.1 )
627627 if stdout or stderr :
628628 poll_streams (result = result )
@@ -662,7 +662,7 @@ def poll_pipes(
662662 concurrent .futures .wait ([future ], timeout )
663663
664664 # Process closed?
665- if stop_event .isSet ():
665+ if stop_event .is_set ():
666666 stop_event .clear ()
667667 interface .close ()
668668 return result
@@ -764,7 +764,7 @@ def execute_together(
764764 remotes , # type: typing.Iterable[SSHClientBase]
765765 command , # type: str
766766 timeout = constants .DEFAULT_TIMEOUT , # type: typing.Optional[int]
767- expected = None , # type: typing.Optional[typing.Iterable[]]
767+ expected = None , # type: typing.Optional[typing.Iterable[int ]]
768768 raise_on_err = True , # type: bool
769769 ** kwargs
770770 ): # type: (...) -> _type_multiple_results
@@ -782,10 +782,8 @@ def execute_together(
782782 :type raise_on_err: bool
783783 :return: dictionary {(hostname, port): result}
784784 :rtype: typing.Dict[typing.Tuple[str, int], exec_result.ExecResult]
785- :raises ParallelCallProcessError:
786- Unexpected any code at lest on one target
787- :raises ParallelCallExceptions:
788- At lest one exception raised during execution (including timeout)
785+ :raises ParallelCallProcessError: Unexpected any code at lest on one target
786+ :raises ParallelCallExceptions: At lest one exception raised during execution (including timeout)
789787
790788 .. versionchanged:: 1.2.0 default timeout 1 hour
791789 .. versionchanged:: 1.2.0 log_mask_re regex rule for masking cmd
@@ -796,11 +794,14 @@ def get_result(
796794 ): # type: (...) -> exec_result.ExecResult
797795 """Get result from remote call."""
798796 (
799- chan , # type: paramiko.channel.Channel
797+ chan ,
800798 _ ,
801- stderr , # type: paramiko.channel.ChannelFile
802- stdout , # type: paramiko.channel.ChannelFile
803- ) = remote .execute_async (command , ** kwargs )
799+ stderr ,
800+ stdout ,
801+ ) = remote .execute_async (
802+ command ,
803+ ** kwargs
804+ ) # type: _type_execute_async
804805
805806 chan .status_event .wait (timeout )
806807 exit_code = chan .recv_exit_status ()
@@ -832,19 +833,19 @@ def get_result(
832833 futures [remote ] = get_result (remote )
833834
834835 (
835- _ , # type: typing.Set[concurrent.futures.Future]
836- not_done , # type: typing.Set[concurrent.futures.Future]
836+ _ ,
837+ not_done ,
837838 ) = concurrent .futures .wait (
838839 list (futures .values ()),
839840 timeout = timeout
840- )
841+ ) # type: typing.Set[concurrent.futures.Future], typing.Set[concurrent.futures.Future]
841842 for future in not_done :
842843 future .cancel ()
843844
844845 for (
845- remote , # type: SSHClientBase
846- future , # type: concurrent.futures.Future
847- ) in futures .items ():
846+ remote ,
847+ future ,
848+ ) in futures .items (): # type: SSHClientBase, concurrent.futures.Future
848849 try :
849850 result = future .result ()
850851 results [(remote .hostname , remote .port )] = result
0 commit comments