def _from_dict ( cls , _dict ) : args = { } if 'key' in _dict : args [ 'key' ] = Key . _from_dict ( _dict . get ( 'key' ) ) if 'value' in _dict : args [ 'value' ] = Value . _from_dict ( _dict . get ( 'value' ) ) return cls ( * * args )
python dynamic create object from dict
Initialize a KeyValuePair object from a json dictionary .
def _from_dict(cls, _dict):
        """Initialize a KeyValuePair object from a json dictionary."""
        args = {}
        if 'key' in _dict:
            args['key'] = Key._from_dict(_dict.get('key'))
        if 'value' in _dict:
            args['value'] = Value._from_dict(_dict.get('value'))
        return cls(**args)