def from_data(cls, data): """Construct a capsule from its data representation. Parameters ---------- data : :obj:`dict` The data dictionary. Returns ------- :class: `Capsule` The constructed capsule. """ line = Line.from_data(data['line']) capsule = Capsule(line, data['radius']) return capsule
def data(self, data): self.line = Line.from_data(data['line']) self.radius = data['radius']