From a0c51be2289dfa1ff05eb1834452e5808714b64a Mon Sep 17 00:00:00 2001 From: aiordache Date: Thu, 19 Nov 2020 15:38:26 +0100 Subject: [PATCH] Syntax warning fix Signed-off-by: aiordache --- docker/types/containers.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docker/types/containers.py b/docker/types/containers.py index d1938c91d..9fa4656ab 100644 --- a/docker/types/containers.py +++ b/docker/types/containers.py @@ -334,15 +334,11 @@ def __init__(self, version, binds=None, port_bindings=None, if dns_search: self['DnsSearch'] = dns_search - if network_mode is 'host' and port_bindings: + if network_mode == 'host' and port_bindings: raise host_config_incompatible_error( 'network_mode', 'host', 'port_bindings' ) - - if network_mode: - self['NetworkMode'] = network_mode - elif network_mode is None: - self['NetworkMode'] = 'default' + self['NetworkMode'] = network_mode or 'default' if restart_policy: if not isinstance(restart_policy, dict):