Remove unnecessary dict.keys() method calls (api)
Since iter(dict) is equivalent to iter(dict.keys()), it is unnecessary to call the keys() method of a dict, the dictionary itself is enough to be referenced. The shorter form is also considered to be more Pythonic. This patch removes the unnecessary dict.keys() method calls in api. This is a part of a larger patch series that removes dict.keys() method calls. TrivialFix Change-Id: I29000f1f05b90d70109fa01393e97e1ebf450c63
This commit is contained in:
@@ -57,7 +57,7 @@ def validate_sort_dir(sort_dir):
|
||||
def validate_search_filters(filters, allowed_fields):
|
||||
# Very lightweight validation for now
|
||||
# todo: improve this (e.g. https://www.parse.com/docs/rest/guide/#queries)
|
||||
for filter_name in filters.keys():
|
||||
for filter_name in filters:
|
||||
if filter_name not in allowed_fields:
|
||||
raise wsme.exc.ClientSideError(
|
||||
_("Invalid filter: %s") % filter_name)
|
||||
|
||||
Reference in New Issue
Block a user