def from_data(cls, d): # local JSON automation = Automation.from_data(d["automation"]) return cls( d['name'], d['level'], d['school'], d['casttime'], d['range'], d['components'], d['duration'], d['description'], homebrew=False, classes=d['classes'], subclasses=d['subclasses'], ritual=d['ritual'], higherlevels=d['higherlevels'], concentration=d['concentration'], automation=automation, source=d['source'], entity_id=d['id'], page=d['page'], url=d['url'], is_free=d['isFree'])
def initialize_automation(self, data): """ Given an instance that is in the process of being constructed, set up the Automation and return the instance (for initialization chaining). """ from cogs5e.models.automation import Automation self.automation = Automation.from_data(data['automation']) return self
def from_data(cls, data): # local JSON data["range_"] = data.pop("range") # ignore this data["automation"] = Automation.from_data(data["automation"]) return cls(**data)
def from_homebrew(cls, data, source): # homebrew spells data['components'] = parse_homebrew_components(data['components']) data["range_"] = data.pop("range") data["automation"] = Automation.from_data(data["automation"]) return cls(homebrew=True, source=source, **data)