webapp/api/misc/dict2instance.py
def deserialize(cls, json_obj: dict):
        """Quickly deserialize the data, assuming that the data is incorrect format"""
        props = {}
        for prop, DeSerClass in cls.class_properties.items():
            if prop not in json_obj:
                try:
                    props[cls.class_rename_props.get(prop, prop)] = cls.class_property_default_values[prop]
                except KeyError:
                    raise cls.DeserializeErrorClass(f"Invalid data. Missing value for key {prop} in {cls.__name__}")
            else:
                props[cls.class_rename_props.get(prop, prop)] = DeSerClass.deserialize(json_obj[prop])

        # noinspection PyArgumentList
        instance = cls(**props)
        cls.post_deserialize(instance)
        return instance
Quickly deserialize the data, assuming that the data is incorrect format
Quickly deserialize the data, assuming that the data is incorrect format
Quickly deserialize the data assuming that the data is incorrect format
def deserialize(cls, json_obj: dict):
        props = {}
        for prop, DeSerClass in cls.class_properties.items():
            if prop not in json_obj:
                try:
                    props[cls.class_rename_props.get(prop, prop)] = cls.class_property_default_values[prop]
                except KeyError:
                    raise cls.DeserializeErrorClass(f"Invalid data. Missing value for key {prop} in {cls.__name__}")
            else:
                props[cls.class_rename_props.get(prop, prop)] = DeSerClass.deserialize(json_obj[prop])
        instance = cls(**props)
        cls.post_deserialize(instance)
        return instance
def deserialize ( cls , json_obj : dict ) : props = { } for prop , DeSerClass in cls . class_properties . items ( ) : if prop not in json_obj : try : props [ cls . class_rename_props . get ( prop , prop ) ] = cls . class_property_default_values [ prop ] except KeyError : raise cls . DeserializeErrorClass ( f"Invalid data. Missing value for key {prop} in {cls.__name__}" ) else : props [ cls . class_rename_props . get ( prop , prop ) ] = DeSerClass . deserialize ( json_obj [ prop ] ) instance = cls ( ** props ) cls . post_deserialize ( instance ) return instance
Quickly deserialize the data, assuming that the data is incorrect format
Quickly deserialize the data assuming that the data is incorrect format
"""Quickly deserialize the data, assuming that the data is incorrect format""" # noinspection PyArgumentList
cls
json_obj
dict