Changeset - f97d13097760
[Not reviewed]
default
0 1 0
Dennis Fink - 10 years ago 2015-07-07 19:54:07

Use partial for get_identification_key
1 file changed with 3 insertions and 5 deletions:
0 comments (0 inline, 0 general)
spaceapi/sensors.py
Show inline comments
 
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):
0 comments (0 inline, 0 general)