Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
johnandrea authored Oct 20, 2022
1 parent 3ca9556 commit 92908dc
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions readgedcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
This code is released under the MIT License: https://opensource.org/licenses/MIT
Copyright (c) 2022 John A. Andrea
v1.15.10
v1.15.11
"""

import sys
Expand Down Expand Up @@ -202,18 +202,26 @@
def list_intersection( *lists ):
""" For use with find_individuals results.
Return the intersection of all the given lists. """
result = []
first_time = True
result = set()
first_loop = True
for l in lists:
if isinstance( l, Iterable ):
if first_time:
result = [item for item in l]
first_time = False
if first_loop:
result = set( l )
first_loop = False
else:
r = result
result = [item for item in l if item in r]
result.intersection_update( set(l) )
return list( result )

return result

def list_difference( original, *subtract ):
""" For use with find_individuals results.
Return the list "original" with other lists removed. """
result = set( original )
for l in subtract:
if isinstance( l, Iterable ):
result.difference_update( set(l) )
return list( result )


def setup_unicode_table():
Expand Down

0 comments on commit 92908dc

Please sign in to comment.