flake8 fixes

Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
aiordache 2020-10-06 14:15:02 +02:00
parent b72988bc87
commit 593d0c97d3
2 changed files with 7 additions and 4 deletions

View File

@ -97,14 +97,13 @@ class SSHSocket(socket.socket):
self.proc.stdin.flush() self.proc.stdin.flush()
return len(msg) return len(msg)
def recv(self): def recv(self):
if not self.proc: if not self.proc:
raise Exception('SSH subprocess not initiated.' raise Exception('SSH subprocess not initiated.'
'connect() must be called first.') 'connect() must be called first.')
response = self.proc.stdout.read() response = self.proc.stdout.read()
return response return response
def makefile(self, mode): def makefile(self, mode):
if not self.proc or self.proc.stdout.closed: if not self.proc or self.proc.stdout.closed:
buf = io.BytesIO() buf = io.BytesIO()
@ -119,6 +118,7 @@ class SSHSocket(socket.socket):
self.proc.stdin.flush() self.proc.stdin.flush()
self.proc.terminate() self.proc.terminate()
class SSHConnection(httplib.HTTPConnection, object): class SSHConnection(httplib.HTTPConnection, object):
def __init__(self, ssh_transport=None, timeout=60, host=None): def __init__(self, ssh_transport=None, timeout=60, host=None):
super(SSHConnection, self).__init__( super(SSHConnection, self).__init__(
@ -153,7 +153,7 @@ class SSHConnectionPool(urllib3.connectionpool.HTTPConnectionPool):
self.ssh_transport = ssh_client.get_transport() self.ssh_transport = ssh_client.get_transport()
self.timeout = timeout self.timeout = timeout
self.host = host self.host = host
# self.base_url = six.moves.urllib_parse.urlparse(host) # self.base_url = six.moves.urllib_parse.urlparse(host)
self.port = None self.port = None
if ':' in host: if ':' in host:

View File

@ -85,7 +85,10 @@ class BaseAPIIntegrationTest(BaseIntegrationTest):
@staticmethod @staticmethod
def get_client_instance(): def get_client_instance():
return docker.APIClient( return docker.APIClient(
version=TEST_API_VERSION, timeout=60, use_ssh_client=True, **kwargs_from_env() version=TEST_API_VERSION,
timeout=60,
use_ssh_client=True,
**kwargs_from_env()
) )
@staticmethod @staticmethod