def generate_persons(): """Returns example objects of Type `Person`.""" email1, email2, email3 = generate_emails() phone1, phone2, phone3 = generate_phone_numbers() tag1, tag2, tag3 = generate_tags() person3 = Person(first_name="", last_name="", emails=[], phone_numbers=[], tags=[]) person2 = Person(first_name="Yannick", last_name="Müller", emails=[email2, email3], phone_numbers=[phone2, phone3], mentor=person3, tags=[tag2]) person1 = Person(first_name="Markus", last_name="Miller", emails=[email1], phone_numbers=[phone1], mentor=person2, tags=[tag1, tag2, tag3]) return [person1, person2, person3]
def generate_persons(): """Returns example objects of Type `Person`.""" email1, email2, email3 = generate_emails() phone1, phone2, phone3 = generate_phone_numbers() return [Person(first_name="Markus", last_name="Miller", emails=[email1], phone_numbers=[phone1]), Person(first_name="Yannick", last_name="Müller", emails=[email2, email3], phone_numbers=[phone2, phone3]), Person(first_name="", last_name="", emails=[], phone_numbers=[])]
def parse_person(xml): """Parse person defined by XML specification `xml`.""" contact_data = xml_find("contact-data", xml) return (xml_text(xml_find("id", xml)), Person(first_name=xml_text(xml_find("first-name", xml)), last_name=xml_text(xml_find("last-name", xml)), emails=[ parse_email(e) for e in xml_find("email-addresses", contact_data) ], phone_numbers=[ parse_phone_number(e) for e in xml_find("phone-numbers", contact_data) ]))