Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _select_kwargs(**kwargs):
paramiko_kwargs = {}
scp_kwargs = {}
PARAMIKO_KWARGS, _, _, _ = inspect.getargspec(paramiko.SSHClient.connect)
PARAMIKO_KWARGS.pop(0) # strip self
PARAMIKO_KWARGS.append('auto_add_policy')
SCP_KWARGS, _, _, _ = inspect.getargspec(scp.SCPClient.__init__)
SCP_KWARGS.pop(0) # strip self
SCP_KWARGS.pop(0) # strip transport arg (it is passed in _prepare_connection)
for karg, warg in six.iteritems(kwargs):
if karg in PARAMIKO_KWARGS and warg is not None:
paramiko_kwargs[karg] = warg
if karg in SCP_KWARGS and warg is not None:
scp_kwargs[karg] = warg
return paramiko_kwargs, scp_kwargs