def load(self, character: Character) -> [EntityId]: next_entity_ids = [] if self.configuration.load_fathers and character.has_property( PropertyTag.FATHER): next_entity_ids.append( character.get_property(PropertyTag.FATHER).loader) if self.configuration.load_mothers and character.has_property( PropertyTag.MOTHER): next_entity_ids.append( character.get_property(PropertyTag.MOTHER).loader) return next_entity_ids
def load(self, character: Character) -> [EntityId]: next_entity_ids = [] if character.has_property(PropertyTag.SEX): sex = character.get_property(PropertyTag.SEX).value if (sex == Sex.MALE and not self.configuration.load_men_children ) or (sex == Sex.FEMALE and not self.configuration.load_women_children): return [] if character.has_property(PropertyTag.CHILDREN): next_entity_ids = [ child.loader for child in character.get_property(PropertyTag.CHILDREN) ] return next_entity_ids
def create_family(self, character: Character): if not character.has_property( PropertyTag.MOTHER) and not character.has_property( PropertyTag.FATHER): return family_id = '{}//{}'.format( character.get_property(PropertyTag.MOTHER) if character.has_property(PropertyTag.MOTHER) else "", character.get_property(PropertyTag.FATHER) if character.has_property(PropertyTag.FATHER) else "") if family_id in self.families.keys(): self.families[family_id].children_ids.append(character.id) else: family = self.Family('FAM{}'.format(len(self.families.keys()))) if character.has_property( PropertyTag.MOTHER) and character.get_property( PropertyTag.MOTHER).loader in self.database.cache.keys( ): family.mother_id = character.get_property( PropertyTag.MOTHER).loader if character.has_property( PropertyTag.FATHER) and character.get_property( PropertyTag.FATHER).loader in self.database.cache.keys( ): family.father_id = character.get_property( PropertyTag.FATHER).loader family.children_ids.append(character.id) self.families[family_id] = family
def allow_export(self, character: Character) -> bool: if not character.has_property(PropertyTag.SEX): return True sex = character.get_property(PropertyTag.SEX).value return (sex == Sex.MALE and self.configuration.export_men) or ( sex == Sex.FEMALE and self.configuration.export_women)