# HG changeset patch # User Dennis Fink # Date 2015-07-07 19:54:07 # Node ID f97d13097760acef8376ec8e5d29713d2e2ef2b4 # Parent 436de322df819849f801533d351fe5f723c12dc7 Use partial for get_identification_key diff --git a/spaceapi/sensors.py b/spaceapi/sensors.py --- a/spaceapi/sensors.py +++ b/spaceapi/sensors.py @@ -1,5 +1,7 @@ import json +from functools import partial + from pkg_resources import resource_filename import jsonschema @@ -18,11 +20,7 @@ ALLOWED_SENSORS_KEYS = json.load( RADIATON_SUBKEYS = ('alpha', 'beta', 'gamma', 'beta_gamma') -IDENTIFICATION_KEYS = ('name', 'location') - - -def get_identification_key(data): - return first(data, IDENTIFICATION_KEYS) +get_identifacation_key = partial(first, keys=('name', 'location')) def set_value(data, key):