Beispiel #1
0
    def get_relationship(self, member, relation):
        person = self.search_member(member.name)

        if (relation == constants.SIBLINGS):
            result = self.in_order([
                sibling.name
                for sibling in person.get_brother() + person.get_sister()
            ])
        elif (relation == constants.PATERNAL_UNCLE):
            result = self.in_order(
                [per.name for per in person.get_paternal_uncle()])
        elif (relation == constants.PATERNAL_AUNT):
            result = self.in_order(
                [per.name for per in person.get_paternal_aunt()])
        elif (relation == constants.MATERNAL_UNCLE):
            result = self.in_order(
                [per.name for per in person.get_maternal_uncle()])
        elif (relation == constants.MATERNAL_AUNT):
            result = self.in_order(
                [per.name for per in person.get_maternal_aunt()])
        elif (relation == constants.COMMAND_SON):
            result = self.in_order([per.name for per in person.sons])
        elif (relation == constants.COMMAND_DAUGHTER):
            result = self.in_order([per.name for per in person.daughters])
        elif (relation == constants.SISTER_IN_LAW):
            result = self.in_order(
                [inlaw.name for inlaw in person.get_sister_in_law()])
        elif (relation == constants.BROTHER_IN_LAW):
            result = self.in_order(
                [inlaw.name for inlaw in person.get_brother_in_law()])
        else:
            raise custom_exceptions.CommandNotFound(constants.COMMAND_ERROR)
        if (len(result) == 0):
            raise custom_exceptions.NullPointer(constants.NULLPOINTER_ERROR)
        return result
Beispiel #2
0
 def get_maternal_uncle(self):
     if self.mother is None:
         raise custom_exceptions.NullPointer(constants.NULLPOINTER_ERROR)
     else:
         mother = self.mother
         return mother.get_brother()
Beispiel #3
0
 def get_paternal_aunt(self):
     if (self.father is None):
         raise custom_exceptions.NullPointer(constants.NULLPOINTER_ERROR)
     else:
         father = self.father
         return father.get_sister()