Browse Source

Fix linters type check

Change-Id: Iac5caa4e559fdce9ccd8b14e76bab786feda0638
changes/53/823953/3
Federico Ressi 4 months ago
parent
commit
ab00cdf3d4
  1. 14
      tobiko/http/_session.py
  2. 7
      tobiko/shell/ssh/_client.py

14
tobiko/http/_session.py

@ -42,7 +42,9 @@ def setup_http_session(session, ssh_client=None):
# All known keyword arguments that could be provided to the pool manager, its
# pools, or the underlying connections. This is used to construct a pool key.
_key_fields = tuple(poolmanager._key_fields) + ('key_ssh_client',)
_key_fields = tuple(
poolmanager._key_fields # type: ignore
) + ('key_ssh_client',)
class PoolKey(collections.namedtuple("PoolKey", _key_fields)): # type: ignore
@ -57,10 +59,12 @@ class PoolKey(collections.namedtuple("PoolKey", _key_fields)): # type: ignore
#: Each PoolManager makes a copy of this dictionary so they can be configured
#: globally here, or individually on the instance.
key_fn_by_scheme = {
"http": functools.partial(poolmanager._default_key_normalizer,
PoolKey),
"https": functools.partial(poolmanager._default_key_normalizer,
PoolKey),
"http": functools.partial(
poolmanager._default_key_normalizer, # type: ignore
PoolKey),
"https": functools.partial(
poolmanager._default_key_normalizer, # type: ignore
PoolKey),
}
# pylint: enable=protected-access

7
tobiko/shell/ssh/_client.py

@ -578,13 +578,14 @@ def ssh_client(host, port=None, username=None, proxy_jump=None,
**connect_parameters)
def load_private_keys(key_filenames: typing.List[str]):
pkeys = []
def load_private_keys(key_filenames: typing.List[str]) \
-> typing.List[paramiko.PKey]:
pkeys: typing.List[paramiko.PKey] = []
for filename in key_filenames:
if os.path.exists(filename):
try:
with io.open(filename, 'rt') as fd:
pkey = paramiko.RSAKey.from_private_key(fd)
pkey: paramiko.PKey = paramiko.RSAKey.from_private_key(fd)
except Exception:
LOG.error('Unable to get RSAKey private key from file: '
f'{filename}', exc_info=1)

Loading…
Cancel
Save