embedded/raspberry/server/traffic_light/views.py
def animation():
    '''
    POST /change_lights
    -------------------
    Stores a new submitted animation json file.
    '''
    data = request.json

    def compare(list1, list2):
        return collections.Counter(list1) == collections.Counter(list2)

    if not compare(['name', 'fps', 'looped', 'frames'], data.keys()):
        return 'Invalid animation JSON.', 400

    with open('server/static/animations/{}.json'.format(data['name']), 'w') as animation_file:
        json.dump(data, animation_file)

    return 'OK', 200

    POST /change_lights
    -------------------
    Stores a new submitted animation json file.
    
POST /change_lights
Stores a new submitted animation json file.
POST / change_lights Stores a new submitted animation json file .
def animation():
    data = request.json
    def compare(list1, list2):
        return collections.Counter(list1) == collections.Counter(list2)
    if not compare(['name', 'fps', 'looped', 'frames'], data.keys()):
        return 'Invalid animation JSON.', 400
    with open('server/static/animations/{}.json'.format(data['name']), 'w') as animation_file:
        json.dump(data, animation_file)
    return 'OK', 200
def animation ( ) : data = request . json def compare ( list1 , list2 ) : return collections . Counter ( list1 ) == collections . Counter ( list2 ) if not compare ( [ 'name' , 'fps' , 'looped' , 'frames' ] , data . keys ( ) ) : return 'Invalid animation JSON.' , 400 with open ( 'server/static/animations/{}.json' . format ( data [ 'name' ] ) , 'w' ) as animation_file : json . dump ( data , animation_file ) return 'OK' , 200
POST /change_lights
Stores a new submitted animation json file.
POST / change_lights Stores a new submitted animation json file .
'''
    POST /change_lights
    -------------------
    Stores a new submitted animation json file.
    '''