def from_dict(cls, d):
     """
     Restores an object state from a dictionary, used in de-JSONification.
     :param d: the object dictionary
     :type d: dict
     :return: the object
     :rtype: object
     """
     result = super(ActorHandler, cls).from_dict(d)
     if "actors" in d:
         l = d["actors"]
         for e in l:
             if u"type" in e:
                 typestr = e[u"type"]
             else:
                 typestr = e["type"]
             result.actors.append(classes.get_dict_handler(typestr)(e))
     return result
Exemple #2
0
 def from_dict(cls, d):
     """
     Restores an object state from a dictionary, used in de-JSONification.
     :param d: the object dictionary
     :type d: dict
     :return: the object
     :rtype: object
     """
     result = super(ActorHandler, cls).from_dict(d)
     if "actors" in d:
         l = d["actors"]
         for e in l:
             if u"type" in e:
                 typestr = e[u"type"]
             else:
                 typestr = e["type"]
             result.actors.append(classes.get_dict_handler(typestr)(e))
     return result
 def from_dict(cls, d):
     """
     Restores an object state from a dictionary, used in de-JSONification.
     :param d: the object dictionary
     :type d: dict
     :return: the object
     :rtype: object
     """
     conf = {}
     for k in d["config"]:
         v = d["config"][k]
         if isinstance(v, dict):
             if u"type" in v:
                 typestr = v[u"type"]
             else:
                 typestr = v["type"]
             conf[str(k)] = classes.get_dict_handler(typestr)(v)
         else:
             conf[str(k)] = v
     return classes.get_class(d["class"])(name=d["name"], config=conf)
 def from_dict(cls, d):
     """
     Restores an object state from a dictionary, used in de-JSONification.
     :param d: the object dictionary
     :type d: dict
     :return: the object
     :rtype: object
     """
     conf = {}
     for k in d["config"]:
         v = d["config"][k]
         if isinstance(v, dict):
             if u"type" in v:
                 typestr = v[u"type"]
             else:
                 typestr = v["type"]
             conf[str(k)] = classes.get_dict_handler(typestr)(v)
         else:
             conf[str(k)] = v
     return classes.get_class(d["class"])(name=d["name"], config=conf)