Skip to content

Commit

Permalink
fix: py2.7 filter slowness
Browse files Browse the repository at this point in the history
  • Loading branch information
clslgrnc committed Aug 25, 2020
1 parent 8491566 commit be52a31
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions stix2matcher/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1448,9 +1448,9 @@ def check_within(binding):
duration
)

filtered_bindings = filter(check_within, bindings)
filtered_bindings = (binding for binding in bindings if check_within(binding))

self.__push(iter(filtered_bindings), debug_label)
self.__push(filtered_bindings, debug_label)

def exitObservationExpressionStartStop(self, ctx):
"""
Expand Down Expand Up @@ -1484,11 +1484,11 @@ def check_within(binding):
# satisfy, since a value can't be both >= and < the same number.
# And of course it's impossible if start > stop.
if start_time < stop_time:
filtered_bindings = filter(check_within, bindings)
filtered_bindings = (binding for binding in bindings if check_within(binding))
else:
filtered_bindings = ()
filtered_bindings = iter(())

self.__push(iter(filtered_bindings), debug_label)
self.__push(filtered_bindings, debug_label)

def exitStartStopQualifier(self, ctx):
"""
Expand Down

0 comments on commit be52a31

Please sign in to comment.