# HG changeset patch # User Dennis Fink # Date 2015-07-07 19:19:52 # Node ID 75e886b91cc0ba974e970fc859086509341fac8f # Parent 16160deb284a3e681fa0faf42be7bd93ce639e48 Fixed line endings in utils.py diff --git a/spaceapi/utils.py b/spaceapi/utils.py --- a/spaceapi/utils.py +++ b/spaceapi/utils.py @@ -1,25 +1,27 @@ -from flask import request - -def request_wants_json(): - best = request.accept_mimetypes.best_match( - ['application/json', 'text/html'] - ) - return best == 'application/json' and \ - request.accept_mimetypes[best] > \ - request.accept_mimetypes['text/html'] - - -def fuzzy_list_find(lst, key, value): - - for i, dic in enumerate(lst): - if dic[key] == value: - return i - - raise ValueError - -def first(iterable, keys): - for el in keys: - if el in iterable: - return el - - raise ValueError +from flask import request + + +def request_wants_json(): + best = request.accept_mimetypes.best_match( + ['application/json', 'text/html'] + ) + return best == 'application/json' and \ + request.accept_mimetypes[best] > \ + request.accept_mimetypes['text/html'] + + +def fuzzy_list_find(lst, key, value): + + for i, dic in enumerate(lst): + if dic[key] == value: + return i + + raise ValueError + + +def first(iterable, keys): + for el in keys: + if el in iterable: + return el + + raise ValueError