nussl/core/migration.py
def _validate_and_populate(self, received):
        """Safe load for metadata according to the expected metadata."""
        result = {}
        for key, expected_val in self.expected_metadata.items():
            val = received.get(key, None)

            if key == 'evaluation':
                eval_dict = received.get('evaluation', {})
                result['evaluation'] = self._load_eval(eval_dict)
            elif type(expected_val) == type:
                result[key] = self._load_types(expected_val, key, val)

            elif type(expected_val) == dict:
                next_dict = {} if val is None else val
                sub_result = {}
                for sub_key, type_ in expected_val.items():
                    sub_val = next_dict.get(sub_key, None)
                    sub_result[sub_key] = self._load_types(type_, sub_key, sub_val)
                result[key] = sub_result

        return result
Safe load for metadata according to the expected metadata.
Safe load for metadata according to the expected metadata.
Safe load for metadata according to the expected metadata .
def _validate_and_populate(self, received):
        result = {}
        for key, expected_val in self.expected_metadata.items():
            val = received.get(key, None)
            if key == 'evaluation':
                eval_dict = received.get('evaluation', {})
                result['evaluation'] = self._load_eval(eval_dict)
            elif type(expected_val) == type:
                result[key] = self._load_types(expected_val, key, val)
            elif type(expected_val) == dict:
                next_dict = {} if val is None else val
                sub_result = {}
                for sub_key, type_ in expected_val.items():
                    sub_val = next_dict.get(sub_key, None)
                    sub_result[sub_key] = self._load_types(type_, sub_key, sub_val)
                result[key] = sub_result
        return result
def _validate_and_populate ( self , received ) : result = { } for key , expected_val in self . expected_metadata . items ( ) : val = received . get ( key , None ) if key == 'evaluation' : eval_dict = received . get ( 'evaluation' , { } ) result [ 'evaluation' ] = self . _load_eval ( eval_dict ) elif type ( expected_val ) == type : result [ key ] = self . _load_types ( expected_val , key , val ) elif type ( expected_val ) == dict : next_dict = { } if val is None else val sub_result = { } for sub_key , type_ in expected_val . items ( ) : sub_val = next_dict . get ( sub_key , None ) sub_result [ sub_key ] = self . _load_types ( type_ , sub_key , sub_val ) result [ key ] = sub_result return result
Safe load for metadata according to the expected metadata.
Safe load for metadata according to the expected metadata .
"""Safe load for metadata according to the expected metadata."""
self
received