Skip to content

Commit b217829

Browse files
author
Tom Reitz
committed
imporvements per Jay code review
1 parent bc650eb commit b217829

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

lightbeam/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def apply_filters(self, endpoints=[]):
6161
self.logger.critical("selector filtering left no endpoints to process; check your selector for typos?")
6262

6363
# make sure all selectors resolve to an endpoint
64-
unknown_endpoints = list(set(my_endpoints).difference(endpoints))
64+
unknown_endpoints = set(my_endpoints).difference(endpoints)
6565
if unknown_endpoints:
6666
self.logger.critical("no match for selector(s) [{0}] to any endpoint in your API; check for typos?".format(", ".join(unknown_endpoints)))
6767

lightbeam/util.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@ def apply_selections(keys, keep, drop):
5555
# this will be the filtered set of keys
5656
final_keys = []
5757
# populate `final_keys` with `keys` that match `keep`
58-
if len(keep)>0 and not (len(keep)==1 and keep[0]=="*"):
58+
if keep and keep != ["*"]:
5959
for payload_key, keep_key in list(itertools.product(keys, keep)):
6060
if (keys_match(payload_key, keep_key)):
6161
final_keys.append(payload_key)
6262
else: final_keys = keys
6363
# remove from `final_keys` keys that match `drop`
64-
if len(drop)>0 and not (len(drop)==1 and drop[0]==""):
64+
if drop and drop != [""]:
6565
for payload_key, drop_key in list(itertools.product(keys, drop)):
6666
if (keys_match(payload_key, drop_key)):
6767
if payload_key in final_keys: final_keys.remove(payload_key)
68-
# return result
6968
return final_keys
7069

7170
# Compares a key like "stateAbbreviationDescriptors" with a (potentially wildcard) expression

0 commit comments

Comments
 (0)