Ejemplo n.º 1
0
def anonymize_person(person: Person) -> None:
    person.individual_name = None
    person.family_name = None
    for presence in set(person.presences):
        person.presences.remove(presence)
        event = presence.event
        if event is not None:
            for event_presence in event.presences:
                event_presence.person = None
            event.presences = []
    for file in set(person.files):
        file.entities = []
    # If a person is public themselves, or a node connecting other public persons, preserve their place in the graph.
    if person.private and not _has_public_descendants(person):
        person.parents = set()
Ejemplo n.º 2
0
def _parse_person(ancestry: _IntermediateAncestry, element: Element):
    handle = _xpath1(element, './@handle')
    person = Person(str(_xpath1(element, './@id')))
    individual_name_element = _xpath1(
        element, './ns:name[@type="Birth Name"]/ns:first')
    if individual_name_element is not None:
        person.individual_name = individual_name_element.text
    family_name_element = _xpath1(element,
                                  './ns:name[@type="Birth Name"]/ns:surname')
    if family_name_element is not None:
        person.family_name = family_name_element.text
    person.presences = _parse_eventrefs(ancestry, element)
    if str(_xpath1(element, './@priv')) == '1':
        person.private = True

    citation_handles = _xpath(element, './ns:citationref/@hlink')
    for citation_handle in citation_handles:
        person.citations.add(ancestry.citations[citation_handle])

    _parse_objref(ancestry, person, element)
    _parse_urls(person, element)

    ancestry.people[handle] = person