diff --git a/octavia/amphorae/backends/agent/api_server/amphora_info.py b/octavia/amphorae/backends/agent/api_server/amphora_info.py index b27f16095c..19fe755fd7 100644 --- a/octavia/amphorae/backends/agent/api_server/amphora_info.py +++ b/octavia/amphorae/backends/agent/api_server/amphora_info.py @@ -167,7 +167,7 @@ class AmphoraInfo(object): if (item[0] == 'IFLA_IFNAME' and not item[1].startswith('eth')): break - elif item[0] == 'IFLA_IFNAME': + if item[0] == 'IFLA_IFNAME': interface_name = item[1] if item[0] == 'IFLA_STATS64': networks[interface_name] = dict( diff --git a/octavia/amphorae/backends/utils/haproxy_query.py b/octavia/amphorae/backends/utils/haproxy_query.py index cd503412a6..fd7a910f69 100644 --- a/octavia/amphorae/backends/utils/haproxy_query.py +++ b/octavia/amphorae/backends/utils/haproxy_query.py @@ -97,7 +97,7 @@ class HAProxyQuery(object): server_id=server_id)) list_results = results[2:].split('\n') csv_reader = csv.DictReader(list_results) - return [row for row in csv_reader] + return list(csv_reader) def get_pool_status(self): """Get status for each server and the pool as a whole. diff --git a/octavia/amphorae/backends/utils/keepalivedlvs_query.py b/octavia/amphorae/backends/utils/keepalivedlvs_query.py index 9856087dca..00107a4555 100644 --- a/octavia/amphorae/backends/utils/keepalivedlvs_query.py +++ b/octavia/amphorae/backends/utils/keepalivedlvs_query.py @@ -333,11 +333,11 @@ def get_ipvsadm_info(ns_name, is_stats_cmd=False): vs_fields.remove('Flags') rs_fields = fields[index + 1:] for key in list(value_mapping.keys()): - value_mapping[key]['Listener'] = [ - i for i in zip(vs_fields, value_mapping[key]['Listener'])] + value_mapping[key]['Listener'] = list( + zip(vs_fields, value_mapping[key]['Listener'])) member_res = [] for member_value in value_mapping[key]['Members']: - member_res.append([i for i in zip(rs_fields, member_value)]) + member_res.append(list(zip(rs_fields, member_value))) value_mapping[key]['Members'] = member_res return value_mapping diff --git a/octavia/api/v2/controllers/listener.py b/octavia/api/v2/controllers/listener.py index 3701b6f2b9..fc49793ce0 100644 --- a/octavia/api/v2/controllers/listener.py +++ b/octavia/api/v2/controllers/listener.py @@ -445,7 +445,7 @@ class ListenersController(base.BaseController): list(listener.insert_headers.keys()), db_listener.protocol) sni_containers = listener.sni_container_refs or [] - tls_refs = [sni for sni in sni_containers] + tls_refs = list(sni_containers) if listener.default_tls_container_ref: tls_refs.append(listener.default_tls_container_ref) self._validate_tls_refs(tls_refs) diff --git a/octavia/api/v2/controllers/pool.py b/octavia/api/v2/controllers/pool.py index f5b57cc527..701fcf705b 100644 --- a/octavia/api/v2/controllers/pool.py +++ b/octavia/api/v2/controllers/pool.py @@ -142,8 +142,7 @@ class PoolsController(base.BaseController): for attr in dir(request): if attr.startswith('_') or attr in escaped_attrs: continue - else: - request_attrs.append(attr) + request_attrs.append(attr) for req_attr in request_attrs: if (getattr(request, req_attr) and req_attr not in check_attrs): diff --git a/octavia/certificates/common/barbican.py b/octavia/certificates/common/barbican.py index 3b256cab93..cc6c73e4c1 100644 --- a/octavia/certificates/common/barbican.py +++ b/octavia/certificates/common/barbican.py @@ -46,8 +46,7 @@ class BarbicanCert(cert.Cert): if self._cert_container.intermediates: intermediates = encodeutils.to_utf8( self._cert_container.intermediates.payload) - return [imd for imd in cert_parser.get_intermediates_pems( - intermediates)] + return list(cert_parser.get_intermediates_pems(intermediates)) return None def get_private_key(self): diff --git a/octavia/common/config.py b/octavia/common/config.py index fabcccaf65..e60a335f60 100644 --- a/octavia/common/config.py +++ b/octavia/common/config.py @@ -791,9 +791,9 @@ def handle_deprecation_compatibility(): def _enable_pydev(debugger_host, debugger_port): try: - from pydev import pydevd + from pydev import pydevd # pylint: disable=import-outside-toplevel except ImportError: - import pydevd + import pydevd # pylint: disable=import-outside-toplevel pydevd.settrace(debugger_host, port=int(debugger_port), @@ -802,7 +802,7 @@ def _enable_pydev(debugger_host, debugger_port): def _enable_ptvsd(debuggger_host, debugger_port): - import ptvsd + import ptvsd # pylint: disable=import-outside-toplevel # Allow other computers to attach to ptvsd at this IP address and port. ptvsd.enable_attach(address=(debuggger_host, debugger_port), diff --git a/octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py b/octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py index d19005f0b5..df66cc255e 100644 --- a/octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py +++ b/octavia/common/jinja/haproxy/combined_listeners/jinja_cfg.py @@ -490,7 +490,7 @@ class JinjaTemplater(object): if not code: continue - elif '-' in code: + if '-' in code: low, hi = code.split('-')[:2] retval.update( str(i) for i in six.moves.xrange(int(low), int(hi) + 1)) diff --git a/octavia/common/jinja/haproxy/split_listeners/jinja_cfg.py b/octavia/common/jinja/haproxy/split_listeners/jinja_cfg.py index 6bebc4cdce..f9b3d84693 100644 --- a/octavia/common/jinja/haproxy/split_listeners/jinja_cfg.py +++ b/octavia/common/jinja/haproxy/split_listeners/jinja_cfg.py @@ -475,7 +475,7 @@ class JinjaTemplater(object): if not code: continue - elif '-' in code: + if '-' in code: low, hi = code.split('-')[:2] retval.update( str(i) for i in six.moves.xrange(int(low), int(hi) + 1)) diff --git a/octavia/common/tls_utils/cert_parser.py b/octavia/common/tls_utils/cert_parser.py index 43fdcdf25f..b28c3b22e0 100644 --- a/octavia/common/tls_utils/cert_parser.py +++ b/octavia/common/tls_utils/cert_parser.py @@ -149,10 +149,9 @@ def _split_x509s(xstr): curr_pem_block = [] inside_x509 = False continue - else: - if line == X509_BEG.decode('utf-8'): - curr_pem_block.append(line) - inside_x509 = True + if line == X509_BEG.decode('utf-8'): + curr_pem_block.append(line) + inside_x509 = True def _parse_pkcs7_bundle(pkcs7):