mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-28 11:18:19 +08:00
removed the set_trace
This commit is contained in:
+10
-14
@@ -62,8 +62,8 @@ class StatefulTransform(object):
|
||||
self.append_value = tnfm_class.__dict__.get('APPENDER', False)
|
||||
|
||||
# You only one special behavior mode can be set.
|
||||
assert sum(map(int, [self.forward_all,
|
||||
self.update_in_place,
|
||||
assert sum(map(int, [self.forward_all,
|
||||
self.update_in_place,
|
||||
self.append_value])) <= 1
|
||||
|
||||
# Create an instance of our transform class.
|
||||
@@ -81,14 +81,14 @@ class StatefulTransform(object):
|
||||
def _gen(self, stream_in):
|
||||
# IMPORTANT: Messages may contain pointers that are shared with
|
||||
# other streams, so we only manipulate copies.
|
||||
|
||||
|
||||
for message in stream_in:
|
||||
|
||||
# allow upstream generators to yield None to avoid
|
||||
# blocking.
|
||||
if message == None:
|
||||
continue
|
||||
|
||||
|
||||
#TODO: refactor this to avoid unnecessary copying.
|
||||
|
||||
assert_sort_unframe_protocol(message)
|
||||
@@ -117,7 +117,7 @@ class StatefulTransform(object):
|
||||
# TransactionSimulator.
|
||||
elif self.update_in_place:
|
||||
yield tnfm_value
|
||||
|
||||
|
||||
# APPENDER flag should be used to add a single new
|
||||
# key-value pair to the event. The new key is this
|
||||
# transform's namestring, and it's value is the value
|
||||
@@ -149,8 +149,8 @@ class EventWindow:
|
||||
tick. Calls self.handle_add(event) for each event added to the
|
||||
window. Calls self.handle_remove(event) for each event removed
|
||||
from the window. Subclass these methods along with init(*args,
|
||||
**kwargs) to calculate metrics over the window.
|
||||
|
||||
**kwargs) to calculate metrics over the window.
|
||||
|
||||
The market_aware flag is used to toggle whether the eventwindow
|
||||
calculates
|
||||
|
||||
@@ -178,7 +178,7 @@ class EventWindow:
|
||||
else:
|
||||
assert self.delta and not self.days, \
|
||||
"Non-market-aware mode requires a timedelta."
|
||||
|
||||
|
||||
# Set the behavior for dropping events from the back of the
|
||||
# event window.
|
||||
if self.market_aware:
|
||||
@@ -213,16 +213,15 @@ class EventWindow:
|
||||
# oldest newest
|
||||
# | |
|
||||
# V V
|
||||
import nose.tools; nose.tools.set_trace()
|
||||
while self.drop_condition(self.ticks[0].dt, self.ticks[-1].dt):
|
||||
|
||||
|
||||
# popleft removes and returns the oldest tick in self.ticks
|
||||
popped = self.ticks.popleft()
|
||||
|
||||
# Subclasses should override handle_remove to define
|
||||
# behavior for removing ticks.
|
||||
self.handle_remove(popped)
|
||||
|
||||
|
||||
def out_of_market_window(self, oldest, newest):
|
||||
return trading_days_between(oldest, newest) >= self.days
|
||||
|
||||
@@ -240,6 +239,3 @@ class EventWindow:
|
||||
# Something is wrong if new event is older than previous.
|
||||
assert event.dt >= self.ticks[-1].dt, \
|
||||
"Events arrived out of order in EventWindow: %s -> %s" % (event, self.ticks[0])
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user