Skip to content

Commit 67a07d5

Browse files
committed
fix lambda to work on python 3.5
1 parent 5f3da6c commit 67a07d5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

nameparser/parser.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def group_contiguous_integers(data):
2020
position of contiguous numbers in a series
2121
"""
2222
ranges = []
23-
for key, group in groupby(enumerate(data), lambda (index, item): index - item):
24-
group = map(itemgetter(1), group)
23+
for key, group in groupby(enumerate(data), lambda i: i[0] - i[1]):
24+
group = list(map(itemgetter(1), group))
2525
if len(group) > 1:
2626
ranges.append((group[0], group[-1]))
2727
return ranges
@@ -565,8 +565,8 @@ def parse_pieces(self, parts, additional_parts_count=0):
565565
if self.C.regexes.period_not_at_end.match(part):
566566
# split on periods, any of the split pieces titles or suffixes? ("Lt.Gov.")
567567
period_chunks = part.split(".")
568-
titles = filter(self.is_title, period_chunks)
569-
suffixes = filter(self.is_suffix, period_chunks)
568+
titles = list(filter(self.is_title, period_chunks))
569+
suffixes = list(filter(self.is_suffix, period_chunks))
570570

571571
# add the part to the constant so it will be found
572572
if len(list(titles)):
@@ -622,7 +622,7 @@ def join_on_conjunctions(self, pieces, additional_parts_count=0):
622622
for i in contiguous_conj_i:
623623
if type(i) == tuple:
624624
new_piece = " ".join(pieces[ i[0] : i[1]+1] )
625-
delete_i += list(xrange( i[0]+1, i[1]+1 ))
625+
delete_i += list(range( i[0]+1, i[1]+1 ))
626626
pieces[i[0]] = new_piece
627627
else:
628628
new_piece = " ".join(pieces[ i : i+2 ])

0 commit comments

Comments
 (0)