Esempio n. 1
0
 def from_json(cls, d, self=None):
     if self is None:
         self = cls.__new__(cls)
     self = DirectMessage.from_json(d, self)
     self.pinor = [Point.from_json(x) for x in d["data"]["pinor"]]
     self.img = d["data"]["img"]
     return self
Esempio n. 2
0
 def from_json(cls, d, self=None):
     if self is None:
         self = cls.__new__(cls)
     self = DirectMessage.from_json(d, self)
     self.location = Point.from_json(d["data"]["location"])
     self.battery = d["data"]["battery"]
     return self
Esempio n. 3
0
    def from_json(cls, d, self=None):
        new_sector_state = {make_tuple(key): [SectorState(value[0]), value[1]] for key,value in d['sector_state'].items()}
        if self is None:
            self = cls.__new__(cls, Space.from_json(d['space']), d['detection_radius'])
            self.sector_state = new_sector_state
            self.origin = Point.from_json(d['origin'])
            self.detection_radius = int(d['detection_radius'])
            self.y_count = int(d['y_count'])
            self.x_count = int(d['x_count'])
            self.sector_height = int(d['sector_height'])
            self.sector_width = int(d['sector_width'])

        return self
Esempio n. 4
0
 def from_json(cls, d, self=None):
     if self == None:
         self = cls.__new__(cls)
     self = MeshMessage.from_json(d, self)
     self.pinor = [Point.from_json(x) for x in d["data"]["pinor"]]
     return self