Skip to content
Snippets Groups Projects
Commit 6511a2b9 authored by Erik Reid's avatar Erik Reid
Browse files

pep8 (new rules added to latest flake8 release)

parent 2caf4cba
No related branches found
No related tags found
No related merge requests found
......@@ -523,9 +523,9 @@ AND circuit_type = 'Path'
def get_service_users(connection, service_ids):
def _sublists(l, n):
for x in range(0, len(l), n):
yield l[x:x + n]
def _sublists(all, n):
for x in range(0, len(all), n):
yield all[x:x + n]
# not sure how to use a tuple in a prepared statement,
# so this is just doing a dumb string replacement ...
......
......@@ -313,7 +313,7 @@ def load_routers_from_netdash(url):
r = requests.get(url=url)
r.raise_for_status()
return [
l.strip() for l in r.text.splitlines() if l.strip()
ln.strip() for ln in r.text.splitlines() if ln.strip()
]
......
......@@ -21,14 +21,14 @@ def _LOCATION(equipment, name, abbreviation):
}
def _remove_duplicates_from_list(l):
def _remove_duplicates_from_list(all):
"""
removes duplicates from the input list
the list items must be encodable as json
:param l:
:return: a new list with unique elements
"""
tmp_dict = dict([(json.dumps(item, sort_keys=True), item) for item in l])
tmp_dict = dict([(json.dumps(item, sort_keys=True), item) for item in all])
return list(tmp_dict.values())
......
......@@ -34,7 +34,7 @@ def routers(access):
def _routers():
i = 0
for k in redis.scan_iter(f'ims:lg:*'):
for k in redis.scan_iter('ims:lg:*'):
rtr = redis.get(k.decode('utf-8')).decode('utf-8')
rtr = json.loads(rtr)
i += 1
......
......@@ -34,7 +34,7 @@ def routers(access):
def _routers():
i = 0
for k in redis.scan_iter(f'opsdb:lg:*'):
for k in redis.scan_iter('opsdb:lg:*'):
rtr = redis.get(k.decode('utf-8')).decode('utf-8')
rtr = json.loads(rtr)
i += 1
......
......@@ -23,7 +23,7 @@ def access_services():
service = redis.get(k.decode('utf-8')).decode('utf-8')
yield json.loads(service)
cache_key = f'classifier-cache:msr:access-services'
cache_key = 'classifier-cache:msr:access-services'
result = redis.get(cache_key)
if result:
......@@ -35,7 +35,7 @@ def access_services():
if not result:
return Response(
response=f'no access services found',
response='no access services found',
status=404,
mimetype="text/html")
......
......@@ -39,7 +39,7 @@ _broker_db_index = params.get('celery-db-index', DEFAULT_CELERY_DB_INDEX)
if ':' in _broker_hostname:
# assume this means hostname is an ipv6 address
_broker_hostname = f'[_broker_hostname]'
_broker_hostname = f'[{_broker_hostname}]'
broker_url = result_backend = (f'{_broker_scheme}://{_broker_hostname}'
f':{_broker_port}/{_broker_db_index}')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment