4040import threaded
4141import six
4242
43- from exec_helpers import _api
43+ from exec_helpers import api
4444from exec_helpers import constants
4545from exec_helpers import exec_result
4646from exec_helpers import exceptions
@@ -97,10 +97,10 @@ class _MemorizedSSH(type):
9797
9898 @classmethod
9999 def __prepare__ (
100- mcs ,
100+ mcs , # type: typing.Type[_MemorizedSSH]
101101 name , # type: str
102102 bases , # type: typing.Iterable[typing.Type]
103- ** kwargs
103+ ** kwargs # type: typing.Dict
104104 ): # type: (...) -> collections.OrderedDict # pylint: disable=unused-argument
105105 """Metaclass magic for object storage.
106106
@@ -109,7 +109,7 @@ def __prepare__(
109109 return collections .OrderedDict () # pragma: no cover
110110
111111 def __call__ (
112- cls ,
112+ cls , # type: _MemorizedSSH
113113 host , # type: str
114114 port = 22 , # type: int
115115 username = None , # type: typing.Optional[str]
@@ -167,7 +167,7 @@ def __call__(
167167 return ssh
168168
169169 @classmethod
170- def clear_cache (mcs ): # type: () -> None
170+ def clear_cache (mcs ): # type: (typing.Type[_MemorizedSSH] ) -> None
171171 """Clear cached connections for initialize new instance on next call.
172172
173173 getrefcount is used to check for usage.
@@ -185,14 +185,14 @@ def clear_cache(mcs): # type: () -> None
185185 mcs .__cache = {}
186186
187187 @classmethod
188- def close_connections (mcs ): # type: (... ) -> None
188+ def close_connections (mcs ): # type: (typing.Type[_MemorizedSSH] ) -> None
189189 """Close connections for selected or all cached records."""
190190 for ssh in mcs .__cache .values ():
191191 if ssh .is_alive :
192192 ssh .close ()
193193
194194
195- class SSHClientBase (six .with_metaclass (_MemorizedSSH , _api .ExecHelper )):
195+ class SSHClientBase (six .with_metaclass (_MemorizedSSH , api .ExecHelper )):
196196 """SSH Client helper."""
197197
198198 __slots__ = (
@@ -454,7 +454,9 @@ def close(self):
454454
455455 # noinspection PyMethodParameters
456456 @close .class_method
457- def close (cls ): # pylint: disable=no-self-argument
457+ def close ( # pylint: disable=no-self-argument
458+ cls # type: typing.Type[SSHClientBase]
459+ ): # type: (...) -> None
458460 """Close all memorized SSH and SFTP sessions."""
459461 # noinspection PyUnresolvedReferences
460462 cls .__class__ .close_connections ()
0 commit comments