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:
Viktor Varga
2017-08-23 12:38:00 +02:00
parent 2650b89fe5
commit 39e200e5eb
6 changed files with 8 additions and 8 deletions

View File

@@ -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)